![]() Even though you specified that the character should show the falling animation after 0.2 seconds in the peak animation code, before that 0.2 seconds has elapsed, you already meet the requirements for the falling animation code: character is not on the ground, and character's y-speed is greater than 0. Since they're both "if" blocks, they're given equal consideration by the computer. ![]() Assuming that the computer does find that your character's y-speed is 0 and that he's not on the ground, your peak code is being overriden by another code. However, there's one more problem that I'm spotting specifically in your code. I've noticed that in your code in snippetcode.png, your intent is that the peak animation should happen for 0.2 seconds. I don't know how comprehensive the Box2D physics engine is, so this example might not apply.Īnother problem is that the animation may happen so fast, that we just don't see it. We never find that the ball's speed is 0 from our checks, even though it has to have passed 0 between 2 and 3 seconds. ![]() If the ball was thrown upwards at an initial speed of 25, and we check the ball's speed every second, we'll see that the ball's speed is 25 at 0 seconds, 15 at 1 second, 5 at 2 seconds, -5 at 3 seconds. In virtual reality, "physics" is updated and looked at in certain time intervals.įor example, imagine that a ball is thrown up in the air and is accelerating downwards due to gravity by 10. Theoretically, an object's speed at the peak of a jump is indeed 0. If the boolean for facing left is false, it implies that the character is facing right.ġ.) IMO, this problem is probably harder than it needs to be, because we're human and a computer is a silly stupid piece of junk. If you have some animation where he's neither facing left or right, then disregard this paragraph xD Otherwise, first thing's first, you don't need a boolean for facing left and a boolean for facing right. I'm no stranger to coding, but I'm new to making games xD So take my advice for what it's worth. Graphics by me btw, my current jump does not play the falling animation when he falls out of gravity (walking off a platform)Ģ) How do I make it that the character stops in place when both left and right buttons are down at simultaneously (not needed to be at exactly the same time but you get it) It's my first time to use this and it's my first day. Running (made this myself very proud of it) How do I get this to work? I'm also having trouble with the facing right facing left situation. 2 secs)įalling (1 looping frame in air until it hits the ground) Peak (1 frame at the peak of the arc/jump. Rising (1 looping frame in air until it hits the peak of its arc/jump) Here's a screenshot of what I have so far and I'm very proud of it considering that it's my first time to use this will little to none knowledge on programming.ġ) I'm having trouble coding the jump (maybe because the jump animation is more complicated than regular ones
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |