Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Kizuna's movement
- // move forward
- if keyboard_check(ord("W"))
- {
- nx = x + lengthdir_x(movespeed,direction);
- ny = y + lengthdir_y(movespeed,direction);
- if !place_meeting(nx, y, obj_wall_basic) //check if object in path
- x = nx;
- if !place_meeting(x, ny, obj_wall_basic) //check if object in path
- y = ny;
- }
- //move backwards
- if keyboard_check(ord("S"))
- {
- nx = x + lengthdir_x(movespeed,direction+180);
- ny = y + lengthdir_y(movespeed,direction+180);
- if !place_meeting(nx, y, obj_wall_basic) //check if object in path
- x = nx;
- if !place_meeting(x, ny, obj_wall_basic) //check if object in path
- y = ny;
- }
- //strafe left
- if keyboard_check(ord("A"))
- {
- nx = x - sin(direction*pi/180)*movespeed;
- ny = y - cos(direction*pi/180)*movespeed;
- if !place_meeting(nx, y, obj_wall_basic) //check if object in path
- x = nx;
- if !place_meeting(x, ny, obj_wall_basic) //check if object in path
- y = ny;
- }
- //strafe right
- if keyboard_check(ord("D"))
- {
- nx = x + sin(direction*pi/180)*movespeed;
- ny = y + cos(direction*pi/180)*movespeed;
- if !place_meeting(nx, y, obj_wall_basic) //check if object in path
- x = nx;
- if !place_meeting(x, ny, obj_wall_basic) //check if object in path
- y = ny;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement