On release for keyboards.

For questions about using Classic.

Post » Tue Nov 11, 2008 12:50 am

I want to make it so that when a player releases a key it jumps according to a charger. The only problem is I cant figure out how to do an on release for a keyboard I didn't see an option for it in the menus...
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Tue Nov 11, 2008 1:59 am

1. make a player holds key down condition
2.right click it, then click invert condition (this means the event will trigger when the player is NOT doing that action, (holding the key down in your case))
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Tue Nov 11, 2008 3:07 am

that is how I had it coded but it still dose not work right because it will keep doing the action as long as it is not down.which is a problem since it is for jumping. where as on release will do it when the button is released. Thank you for the reply though.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Tue Nov 11, 2008 4:45 am

Add a 'trigger once while true' to that 'key is not down' condition.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Nov 11, 2008 8:01 am

[url:1vv78so5]http://www.republika.pl/tymczasownik/onRelease.cap[/url:1vv78so5] (working with SHIFT - check event sheet)
Arima's solution sound better though ^^.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Tue Nov 11, 2008 12:51 pm

I tried Arimas solution still no luck... Ill try yours as soon as I can Broo.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Tue Nov 11, 2008 12:56 pm

You could also try adding a private varable.

In pseudo code:

+On pressing key (whatever)
-Set "player" private variable "jump" to 1

+On not pressing key (whatever)
+"player" private variable "jump" equals 1
-Do stuff

+"player" jump animation is finished
-Set "player" private variable "jump" to 0

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Nov 11, 2008 1:16 pm

I've reuploaded file:
[url:3i867e4h]http://www.republika.pl/tymczasownik/onRelease.cap[/url:3i867e4h]

Here both methods (using PV as memory and using Trigger Once & Invert) work.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Tue Nov 11, 2008 9:49 pm

[quote="Arima":1yvccb5l]Add a 'trigger once while true' to that 'key is not down' condition.[/quote:1yvccb5l]

this will work fine.
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Wed Nov 12, 2008 3:15 pm

[quote="Aeal5566":2haluevd]I tried Arimas solution still no luck... Ill try yours as soon as I can Broo.[/quote:2haluevd]


^It didnt work
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests