Sprite: spr_ship
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code: //Set no keypress ship_is_h=""; ship_is_v=""; //keyboard input if (keyboard_check(vk_left)) {ship_is_h="left";} if (keyboard_check(vk_right)) {ship_is_h="right";} if (keyboard_check(vk_up)) {ship_is_v="up";} //move in direction if ship_is_h=="right" hspeed+=0.16; if ship_is_h=="left" hspeed-=0.16; //friction hspeed=hspeed*0.99; if abs(hspeed)<0.05 hspeed=0; //up and down movement dist=obj_platform.y-y; if obj_platform.y<y ship_is_v="up"; if ship_is_v=="up" vspeed-=0.16; //gravity vspeed+=0.02; //check if on platform and moving slowly if position_meeting(x,y,obj_platform) && abs(vspeed)<1 and abs(hspeed)<1 { show_message("Landed"); game_restart(); }
No comments:
Post a Comment