Pages: 1
  Print  
Author Topic: Double-Click/Button Press?  (Read 3131 times)
Offline (Unknown gender) AsherOS
Posted on: September 03, 2013, 01:38:33 PM
Member
Joined: Jul 2013
Posts: 19

View Profile
In my game, I have "F" as the button for melee assassinations, but I also want to use it for the other gadgets in my game. I want to be able to use a double button press to detonate a remote explosive, similar to the double "X" or "square" press in CoD to detonate C4.

How do I make this distinction?

Cheers,
Asher
Logged
Offline (Male) Goombert
Reply #1 Posted on: September 03, 2013, 01:57:09 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
Well neither Game Maker or ENIGMA provide this behavior by default. But you raise an interesting suggestion of something could be implemented. But for now just do as it would be done in Game Maker, eg. create a variable
Code: [Select]
mouse_left_clicks = 0; in the create event and everytime the mouse left button occurs or you check it with
Code: [Select]
mouse_check_button(mb_left); just do this
Code: [Select]
mouse_left_clicks += 1; and then...

Code: [Select]
if (mouse_check_button(mb_left) && mouse_left_clicks >= 2) {
  mouse_left_clicks = 0;
  // do stuff
}

But ya, like I said we should look at maybe how we could implement this to ENIGMA to make it easier.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) AsherOS
Reply #2 Posted on: September 03, 2013, 02:00:55 PM
Member
Joined: Jul 2013
Posts: 19

View Profile
Thanks. I was actually kind of surprised when I found out it wasn't a default feature.

Double clicks/press' would be a great feature to add
Logged
Offline (Male) Goombert
Reply #3 Posted on: September 03, 2013, 02:03:40 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
Ha, if only I could clone myself, right now I am redesigning our sprite editor...
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) AsherOS
Reply #4 Posted on: September 03, 2013, 02:05:41 PM
Member
Joined: Jul 2013
Posts: 19

View Profile
That is something I will very much appreciate!  :D Everyone's got their hands full these days.
Logged
Offline (Unknown gender) TheExDeus
Reply #5 Posted on: September 03, 2013, 02:27:24 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
Things that are easy to implement in EDL (like Robert's few lines of code shows) usually are not good things to actually implement in ENIGMA as this way you have a lot more control. Problem here being that it would have to be strictly "standardized" or outlined. For example, how long should the presses be counted? When should they be clear? When you press another button? But then you won't be able to run and activate the ability at the same time. If it clears based on time, then what time? And be measured in what? Probably steps, but then the default value would usually be unsuitable and a function to set this time would have to be used. Or it needs to be cleared on times (just like Robert code, so it works even in rapid succession), but setting this for all inputs would be hassle. So a manual control for count clearing would have to be used as well. So maybe this could be added as an extension to ENIGMA just in case someone wants a ready made (but probably less flexible) solution. So in the end it would probably take even more code to use that extension than to code your own.

Also, your example mentions xbox (or similar) controller. That in itself is an extension and it would be more complicated to add a system like this for other inputs which can be controllers. Especially if it is an extension.

So it would probably always take less time and be less of a hassle to code this yourself, but I guess we can consider this. Maybe I will make an extension like that for keyboard and mouse.
« Last Edit: September 03, 2013, 02:30:53 PM by TheExDeus » Logged
Offline (Unknown gender) AsherOS
Reply #6 Posted on: September 03, 2013, 02:50:09 PM
Member
Joined: Jul 2013
Posts: 19

View Profile
I was just using the console game as an example, I have no intention of using controllers.
Logged
Offline (Unknown gender) TheExDeus
Reply #7 Posted on: September 03, 2013, 03:31:19 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
I was just pointing out how complicated even the simplest things can be. Because if that is an extension (or built-in in ENIGMA without one), then others might think it should work for controllers too (which is reasonable) and so people will post here in confusion.
So for now I think the simplest things which can be done in pure EDL without problems should be done in EDL.
But thanks for the suggestion. I and others will probably consider it (the previous post was actually me considering it) and see if is doable.
Logged
Offline (Male) Goombert
Reply #8 Posted on: September 03, 2013, 04:35:30 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
Harri, I was thinking of maybe some way to abstract the events was all, not suggesting implementing a counter when its never used.

AsherOS, we do have an XInput extension I wrote though, you can hook up and use your Xbox 360 controller if you have one, joysticks are also implemented, without extension on Linux but on Windows you enable DirectInput.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) AsherOS
Reply #9 Posted on: September 04, 2013, 03:45:57 PM
Member
Joined: Jul 2013
Posts: 19

View Profile
This is just out of curiosity, but would it be possible to make an emulator to play a game made in enigma on other platforms like consoles or mobile?
Logged
Offline (Male) Goombert
Reply #10 Posted on: September 04, 2013, 04:32:28 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
Yes, that would be possible but a 1000x more work than just doing our various ports. We plan to do ports to Android and stuff but we need our new compiler finished first so that it can export using pretty printers to JavaScript/HTML5 etc.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) AsherOS
Reply #11 Posted on: September 06, 2013, 01:17:38 AM
Member
Joined: Jul 2013
Posts: 19

View Profile
I figured it would be more work. That compiler sounds cool though.
Logged
Pages: 1
  Print