I do know I can change the
vspeed properties on my object. Assume I do it for the directional diamond in a squared-style motion recreation (not necesarily snapping to tiles, however it may). So the next situations apply (for any fixed Okay) for my
- Pressing UP: vspeed is -Okay, hspeed is 0
- Pressing DOWN: vspeed is Okay, hspeed is 0
- Pressing LEFT: vspeed is 0, hspeed is -Okay
- Pressing RIGHT: vspeed is 0, hspeed is +Okay
- Otherwis: vspeed and hspeed are 0
- Only one directional arrow on the identical time might be thought of (the final pressed).
My participant begins from place of an
obj_Start object, and wins when reaching (colliding) an
obj_End object. In the meantime, an
obj_Enemy might be chasing the participant utilizing a step keep away from technique to keep away from the participant. The participant loses if the enemy collides with him. Assuming I can appropriately choose the enemy present route sprite, I’m carried out.
So far, so good.
Now assume some components of my recreation have transferring platforms. They have a particular platform velocity vector (PSH, PSV), assuming I’ve such constants.
I do know I may at all times situation my participant motion velocity to be:
(Okay + PSH, PSV)for participant transferring proper
(-Okay + PSH, PSV)for participant transferring left
(PSH, Okay + PSV)for participant transferring down
(PSH, -Okay + PSV)for participant transferring up
(PSH, PSV)for participant not transferring
But… How do I alter (relative to the platform motion, as I do with the participant) the enemy motion when it’s truly generated by the step avoiding technique?