【GameMaker】 Top Down Football

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

motion_set(random(360),2);
Step Event:
execute code:

inst=instance_nearest(x,y,obj_player);//get id of nearest player

if (keyboard_check(ord('A')))  {inst.x-=5;} //make inst move
if (keyboard_check(ord('D')))  {inst.x+=5;} 
if (keyboard_check(ord('W')))  {inst.y-=5;} 
if (keyboard_check(ord('S')))  {inst.y+=5;}
Collision Event with object obj_border:
execute code:

hspeed*=-1;
vspeed*=-1;
Collision Event with object obj_player:
execute code:

hspeed*=-1;
vspeed*=-1;

No comments:

This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…

Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital.  ͏     ­͏     ­͏   ...

Contact Form

Name

Email *

Message *