【GameMaker】 Drop the Coin physics engine

Information about object: obj_wall
Sprite: spr_wall
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: obj_solid_parent
Children:
Mask:
No Physics Object


Information about object: obj_dropper
Sprite: spr_dropper
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:

x=mouse_x;//update x position
Mouse Event for Glob Left Released:
execute code:

instance_create(x,50,obj_ball);//create a ball

Draw GUI Event:
execute code:

draw_text(50,50,"score "+string(score));//draw score


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

move_bounce_solid(true);//set to bounce on solid objects
motion_set(270,0.5);//set the ball moving down
gravity_direction = 270;//set gravity direction
gravity=1;//set gravity strength

Step Event:
execute code:

vspeed*=0.9;//reduce speed
Collision Event with object obj_solid_parent:
execute code:

move_bounce_solid(true);
var rand_direction=irandom_range(-3,3);//create slightly random direction to stop getting stuck
direction+=rand_direction;//update direction


Information about object: obj_peg
Sprite: spr_peg Solid: true Visible: true Depth: 0 Persistent: false Parent: obj_solid_parent Children: Mask:
No Physics Object
Information about object: obj_solid_parent
Sprite: Solid: false Visible: true Depth: 0 Persistent: false Parent:
Children obj_wall obj_peg
Mask:
No Physics Object
Information about object: obj_10_points
Sprite: spr_points Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Collision Event with object obj_ball:
execute code:

score+=10;
with (other) instance_destroy();


Information about object: obj_20_points
Sprite: spr_points Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Collision Event with object obj_ball:
execute code:

score+=20;
with (other) instance_destroy();


Information about object: obj_30_points
Sprite: spr_points Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Collision Event with object obj_ball:
execute code:

score+=30;
with (other) instance_destroy();


Information about object: obj_50_points
Sprite: spr_points Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Collision Event with object obj_ball:
execute code:

score+=50;
with (other) instance_destroy();

No comments:

When Bad People Make Good Art

I offer six guidelines on cancel culture ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏...

Contact Form

Name

Email *

Message *