4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.82k stars 848 forks source link

Add a condition for "Any key released" #1510

Closed shadow00dev closed 3 years ago

shadow00dev commented 4 years ago

Hello, also I did talk about me asking about this and if it was added and that and I did say I would request it.

Description

It's a request to add a new condition and I want it to be added because of.

  1. I know it's not there.

  2. I really need it so I can make a check if I released a key (for example) 3 times.

Solution suggested

I got given some code so I could add it to an extension and the code is.

eventsFunctionContext.returnValue = false;
for(var keyCode in this._releasedKeys.items) { 
if (this._releasedKeys.items.hasOwnProperty(keyCode)) { 
   if (this._releasedKeys.items[keyCode]) {
       eventsFunctionContext.returnValue = true; 
   }
 }
} 

The person who gave me the code was arhturo555.

The thing I want to be added.

What I want to be added is Any key released.

Any key released will be like Any key pressed and the key is released.

Alternatives considered

I only know of one way that it works and that is that code that arhturo555 gave me.

I hope this makes sense also I only tried again because I asked if I should and the person said yes but try doing it a bit better.

4ian commented 4 years ago

So it's better but please edit your message to use:

I'm not a native english speaker and it's hard for me to read. Start your sentence with a capital. End them with a period. Don't start with "by the way". I want your message to be crystal clear and perfectly written.

Then maybe some one will have the time to do it - but only if it's well written. Thanks for your efforts so far! :) (No need to answer, just edit your first message)

shadow00dev commented 4 years ago

hope this is better now (also I know my writing is bad and that but I do try you know also I find it had to make things make sense in fact if anyone has heard me talk it would make no sense (i got told))

(reply to 4ian)

Silver-Streak commented 4 years ago

Looking at this request, I think the ask is for the following:

@twistcharlie Please confirm the above is accurate or if I'm missing something. If the above is accurate, hopefully this will help the devs make a determination if this is something they want to add.

shadow00dev commented 4 years ago

silver-streak its basically any keypress but instead of pressed it's released also I gave the code arthuro555 gave me there so yah and yah basically ur right

Oxey405 commented 3 years ago

I think I can try to fix it...

4ian commented 3 years ago

Feel free to go ahead!

Oxey405 commented 3 years ago

thank you but I can't find the file where the keyboard events are handled...

Bouh commented 3 years ago

Declaration Core\GDCore\Extensions\Builtin\KeyboardExtension.cpp

Binding declaration with GDJS GDJS\GDJS\Extensions\Builtin\KeyboardExtension.cpp

Same for the core in C++ if one day we go back on it. GDCpp\GDCpp\Extensions\Builtin\KeyboardExtension.cpp

GDJS tools (runtime code) used in previews and final games. C:\GDevelop\GDJS\Runtime\events-tools\inputtools.ts

GDJS manager used in GDJS tools, C:\GDevelop\GDJS\Runtime\inputmanager.ts

And if you still have 1 minute for the tests it's two lines ;) \GDJS\tests\tests\inputmanager.js

I don't think I said anything stupid, 4ian feel free to edit my post if needed.

Oxey405 commented 3 years ago

Okay thank you Bouh !