Is this a bug of my making, or C3?

Post » Sun Apr 23, 2017 12:45 am

Hi all, I've got a weird bug happening. I've set up a player death animation, and I set spacebar to toggle the Player.Dead variable for testing purposes. It's acting inconsistent. If I re-arrange the order of the commands it acts different. But sometimes it will behave differently even without re-arranging the commands.

I made a video showing it in action. There is no sound. Sorry if I go to vast when showing you the logic - I should have taken more time there, so please pause it if you need to read through it.

Video is here: https://youtu.be/jMfr3zFM88s
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Mon Apr 24, 2017 10:27 am

It's very hard to help from videos or screenshots. Sharing your project is the best way to have this investigated.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Tue Apr 25, 2017 12:07 am

Ashley wrote:It's very hard to help from videos or screenshots. Sharing your project is the best way to have this investigated.


Sure, thanks! Here's the file. http://mattsfiles.weebly.com/uploads/5/ ... roblem.c3p
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Tue Apr 25, 2017 7:55 am

Behaves consistently for me, no matter the order of the events.

When player is "dead" you are setting his vector to upwards every tick, so he never gets around to falling back down.

The only way he falls is if you hit space twice to toggle the dead state again. In your video you were probably getting inconsistent results because your condition was "space is down", so that would toggle on and off every other tick. Basically if you didn't let go of the space key within one frame, the dead state would toggle off again. In the example file you uploaded it looks like you corrected this already.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Apr 25, 2017 5:21 pm

You're right, I did change the Space is down vs Space is pressed thing after posting the video - so that should fix the consistency of it :)

Why is he floating away, though? I didn't mean to set it for every tick. Keep in mind that I'm super new to this, so it's probably the dumbest question in the world. But I don't see it set to "every tick."

Thanks for your help!
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Tue Apr 25, 2017 6:00 pm

The entire event sheet will run once per tick. If the conditions are true, those actions will run.

The exception are triggers (green arrows) which only run once when triggered. You can turn an event into a trigger by adding the "run once while true"condition.

Edit: here are two very useful articles you may not have found.

https://www.scirra.com/manual/75/how-events-work

https://www.scirra.com/blog/141/common- ... nd-gotchas
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 26, 2017 1:10 am

Thank you very much for your response! So, in this case, I need to run the event "Player Is Dead" only once, right? I can't seem to figure out how to do that. Do I set it "every tick" and then invert it?
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Wed Apr 26, 2017 1:14 am

Sorry it was actually "trigger once while true", not run once while true. You can find it in system conditions.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 26, 2017 10:03 pm

Thank you! Got it working :) I appreciate your help on this, simple as it was!
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Thu May 04, 2017 6:25 am

you need to replace "key "space" is down" with: "key "space" on pressed"
B
9
S
5
G
8
Posts: 12
Reputation: 4,920


Return to General Discussion

Who is online

Users browsing this forum: Pooya72 and 1 guest