【GameMaker】Torpedo

Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

motion_set(0,2);//start moving
Step Event:
execute code:

if (keyboard_check(vk_left))  {direction+=2;} //rotate left
if (keyboard_check(vk_right))  {direction-=2;} //rotate right
if (keyboard_check(vk_up))  {speed+=1;} //increasespeed
image_angle=direction;//point in direction moving
if speed>3 speed=3;//cap speed
if speed>2 speed-=0.1;//cap boost speed
Collision Event with object obj_wall:
execute code:

show_message("You Die");
game_restart();
Collision Event with object obj_target:
execute code:

show_message("You Win");
game_restart();

No comments:

Top 3 UX Design Articles of 2024 to Remember

Based on most subscriptions ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *