Strafe Movement (sidestep) in 8 direction movement
Author: | BJ Turner
|
Submitted: | 25th July, 2003
|
Views: | 4779
| Rated: |
|
|
I used this in the game that I was gonna enter in the latest comp, but for reasons beyond my control I was unable to.
This is actually pretty simple once you know what to do.
remember my article about the conveyer belt effect, well the strafe system works like that
First create a character (for this article we are gonna call him "Character") and his movement
Events:
repeat while right arrow is pressed
(negate)repeat while shift is pressed
------------------------------
set direction of character to right
set speed to 20
(do this with all directions)
(negate)repeat while right arrow is pressed
(negate)repeat while left arrow is pressed
(negate)repeat while down arrow is pressed
(negate)repeat while up arrow is pressed
------------------------------------------
set speed to 0
Repeat while right arrow is pressed
repeat while shift is pressed
--------------------------------
set position of character to (2,0) relative to character
Repeat while left arrow is pressed
repeat while shift is pressed
--------------------------------
set position of character to (-2,0) relative to character
Repeat while down arrow is pressed
repeat while shift is pressed
--------------------------------
set position of character to (0,2) relative to character
Repeat while up arrow is pressed
repeat while shift is pressed
--------------------------------
set position of character to (0,-2) relative to character
upon pressing shift
------------------
set speed to zero
There you go!!
Unless you put that last event in then the character will jump forward right after you press shift.
now run your game and you will walk around normally unless you press shift. If you hold shift then you will move around like normal except that you will stay facing the same direction
|
|
|