[r114] On key press

Bugs will be moved here once resolved.

Post » Wed Dec 26, 2012 10:10 pm

Hi,
Here is the thing :


On this situation, X works only to setting FireMode to 0, but not to 1.
If I start the game (FireMode set to 1), pressing X set it to 0. If I press it again, nothing happens.
If I start the game (FireMode set to 0), nothing happens while pressing X.

If I use 2 separate keys on each event, for exemple X and V, it's working.

If I invert events 14 and 15, the problem is inverted.

Same problem with "On a key released".

What's wrong with that ?

I presume Construct is triggering both events 14 and 15 in a row on a single key press, in that case it would be a bug. Only one should be triggered.Tenshi2012-12-26 22:14:38
B
7
S
1
G
3
Posts: 46
Reputation: 1,731

Post » Wed Dec 26, 2012 10:24 pm

I am experiencing a strange error with on pressed as well. It seems like there are multiple events being fired at one press maybe? I have a key press command, where on up press, you change a variable from 0 to 4. Each press sets the number to 3, 2, 1, 0. Strangely, right now, if I press up, it should set it to 4. But it is setting to 3.


In the first image, if I press up, currentlySelected becomes 3. NOT 4.

In the second image, it becomes 4 as expected. Let me know if I am just missing something.

B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Post » Thu Dec 27, 2012 12:41 am

Tenshi and firebelly/: the bugs you just reported are not actually bugs, as far as i know, if Construct 2 works exactly like any programming language (don't wan to get you bored reading long explanations here).

Tenshi: if you put a single keyboard event ("On X press") and two separately sub-events ("FireMode = 0" and "FireMode = 1") in an "Else" event type, i imagine it should work properly. Try it!


firebelly: try to use another variable (lets's gently call it "AlmostTrashVar") just to set the number you've inputed directly in the "CurrentlySelected", and then, outside the event "On Up Arrow pressed", set the "CurrrentlySelected" the value stored in the "AlmostTrashVar".


I hope i could help you.
Sorry sir Moderator if I wasn't able to post an answer here. Oops!sambufalo2012-12-27 01:02:23
B
16
S
4
G
3
Posts: 22
Reputation: 3,007

Post » Thu Dec 27, 2012 2:50 am

Closing as not a bug, neither of these are bugs. Remember events run top to bottom, so in this case multiple events are running in one tick which is probably confusing you. This is why you need to use 'Else'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Dec 28, 2012 12:07 am

Totally my bad on this. Adding Else before each of the statements created the right impact. I was assuming subevents acted as Else Ifs and not Ands. Else Fixed everything.
B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Post » Fri Dec 28, 2012 3:14 am

It would be more efficient as checking all events first and then if conditions of some are met, execute respective actions.
So order wouldn't have any impact, it's usually like that every software of this type are working. ;)

But of course it wokrs with "else". ;)Tenshi2012-12-28 03:31:06
B
7
S
1
G
3
Posts: 46
Reputation: 1,731


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests