【GAMEMAKER】boomerang

  Information about object: objPlayer


Sprite: sprPlayer

Solid: false

Visible: true

Depth: 0

Persistent: false

Parent:

Children:

Mask:

No Physics Object

Create Event:

execute code:


Facing_Direction=0;

Step Event:

execute code:


if keyboard_check(vk_space) && instance_number(objBoomerang)=0 {

  instance_create(x,y,objBoomerang);

}

hspeed=0;

vspeed=0;

if keyboard_check(vk_left) then {hspeed=-4; Facing_Direction=180;}

if keyboard_check(vk_right) then {hspeed=4; Facing_Direction=0;}

if keyboard_check(vk_up) then vspeed=-4;

if keyboard_check(vk_down) then vspeed=4;


Information about object: objBoomerang

Sprite: sprBoomerang

Solid: false

Visible: true

Depth: 

0

Persistent: false

Parent: 

Children: 

Mask: 


No Physics Object


Create Event:

execute code:


Catch=false;

if objPlayer.Facing_Direction=0 {

  hspeed=5;

  vspeed=5;

} else {

  hspeed=-5;

  vspeed=-5;

}


Step Event:

execute code:


if place_meeting(x,y,objPlayer)=false and Catch=false then Catch=true;


if (direction>=point_direction(x,y,objPlayer.x,objPlayer.y)-4 && direction<=point_direction(x,y,objPlayer.x,objPlayer.y)+4) {

  direction=point_direction(x,y,objPlayer.x,objPlayer.y);

} else {

  direction+=4;

}


if direction>360 then direction=4;


Collision Event with object objPlayer:

execute code:


if Catch=true then instance_destroy();


Other Event: Intersect Boundary:

bounce not precisely against solid objects


Information about object: objMonster

Sprite: sprMonster

Solid: false

Visible: true

Depth: 

0

Persistent: false

Parent: 

Children: 

Mask: 


No Physics Object


Collision Event with object objBoomerang:

execute code:


instance_destroy();

No comments:

Top 3 UX Design Articles of 2024 to Remember

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

Contact Form

Name

Email *

Message *