Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Crate event
- ///player variables
- grav = 0.3;
- hsp = 0;
- vsp = 0;
- movespeed = 4;
- jumpspeed_normal = 7;
- jumspeed_powerup = 10;
- jumpspeed = jumpspeed_normal;
- gamepad_set_axis_deadzone(0,0.7);
- Step event
- ///movement
- // Player input
- key_right = keyboard_check(vk_right) || (gamepad_axis_value(0,gp_axislh) > 0);
- key_left = -(keyboard_check(vk_left) || (gamepad_axis_value(0,gp_axislh) < 0));
- key_jump = keyboard_check_pressed(vk_space) || gamepad_button_check_pressed(0,gp_face1);
- //React to inputs
- move = key_left + key_right;
- hsp = move * movespeed;
- if (vsp < 10) vsp += grav;
- if (place_meeting(x,y+1,obj_platfroms))
- {
- vsp = key_jump * -jumpspeed;
- }
- //horzontial colsion
- if (place_meeting(x+hsp,y,obj_platfroms))
- {
- while(!place_meeting(x+sign(hsp),y,obj_platfroms))
- {
- x += sign(hsp);
- }
- hsp = 0;
- }
- x += hsp;
- //vertical colsion
- if (place_meeting(x,y+vsp,obj_platfroms))
- {
- while(!place_meeting(x,y+sign(vsp),obj_platfroms))
- {
- y += sign(vsp);
- }
- vsp = 0;
- }
- y += vsp;
- wasd movement
- //movement
- var xDirection, yDirection;
- xDirection = keyboard_check(ord("D"))- keyboard_check(ord("A"));
- yDirection = keyboard_check(ord("S"))- keyboard_check(ord("W"));
- x += xDirection * 3
- y += yDirection * 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement