Key is Pressed Problem

For questions about using Classic.

Post » Tue Mar 09, 2010 8:03 pm

In a menu for my game I have where you press Enter to select which menu you want to go into. It shows the proper layers and enables the proper event sheet. The problem is, as soon as the even sheet is enabled, Construct sees an Enter Key is Pressed event in the newly enabled event sheet and runs that event because it is all working in the same tick. What is the best way to prevent this?
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Tue Mar 09, 2010 8:06 pm

Could try grouping things separately and toggling them on/off?
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Mar 09, 2010 8:08 pm

Hm, yeah, that could get tricky. You can use a global variable; when you press the Enter key, add to this variable and compare it in event sheet to make sure it hasn't already been pressed. That's the quick solution I thought of.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Wed Mar 10, 2010 4:48 am

use a finite state machine instead of enabling-disabling groups.
There's a plugin for it now.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed Mar 10, 2010 4:53 am

[quote="madster":1mgp9yff]use a finite state machine instead of enabling-disabling groups.
There's a plugin for it now.[/quote:1mgp9yff]
I was at first thinking of something like Mipey mentioned, but I'll definately look into the state machine thing.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests