Game Development Reference
In-Depth Information
If you change the Platform's Friction value and set it much higher, our actor won't
move very well, which would be good for super sticky platforms. We are now
going to work on jumping. You want him to jump only when he is colliding with
the ground, otherwise the player could keep pressing the jump button and he
would just continue to fly; which would be cool, but it wouldn't make the levels
very challenging now, would it? Let's go back to editing our Kevin actor. We need
to create a new attribute within the actor itself, so in the Attributes window, click
on the + button, select Boolean , and name it OnGround , and leave it unchecked.
Create a new rule, and change it to Actor receives event | overlaps of collides |
with actor with tag: | Platforms . Then drag in another rule, change it to Attribute
| self.Motion Linear Velocity.Y | < 1 , then click on the + button within the
rule to create another condition, and change it to Attribute | self.Motion Linear
Velocity.Y > -1 .
Whoa there cowboy! What does this mean? Let's break it down. This is detecting the
actor's up and down motion, so when he is going slower than 1, and faster than -1,
we will change the attribute.
Why do this? It's a bit of a fail safe, so when the actor jumps and the player keeps
holding the jump key, he doesn't keep jumping. If we didn't add these conditions,
the player could jump at times when he shouldn't. Within that rule, drag in a Change
Attribute behavior, and change it to Change Attribute: | self.OnGround To 1 . (1
being true, 0 being false, or you can type in true or false.)
 
Search WWH ::




Custom Search