Game Development Reference
In-Depth Information
If you create a hill that is too steep, the enemy won't be able to make it up it using
this method. No problem, we can fix this! Create another rule, name it
Can't get
up?
. Change the first condition to
Attribute
|
self.Motion.Linear Velocity.X
|
>
|
0
, and the second will be the same, but less than
250
. This will detect if he is
slowing down. Now another timer will be after 0.5 seconds. Inside the timer, drag an
Accelerate
behavior, keep the
Direction
to
0
, and the
Acceleration
to
500
. Test it out,
he will now shoot up the hill!
Why the Timer there? While testing I found that, if he went down a hill and hit
something, he immediately accelerated backwards without flipping. Everything
needs some time to react and make sure it's not interfering with other conditions.
That's pretty simple, isn't it? It certainly removes a lot of time when programming our
games. Think of all the lines of coding just to get our enemy moving and rotating! Not
even including physics, collision detection, and our make-shift pathfinding.