【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:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *