Sprite: spr_ball
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: strength=0;//set up
Step Event:
execute code:
strength=distance_to_point(mouse_x,mouse_y)/5;//calculate strength based on distance to mouse
if mouse_check_button_released(mb_left)//do this when mouse released
{
direction=point_direction(x,y,mouse_x,mouse_y);//setdirection towards mouse
speed=strength;//set the speed
}
speed*=0.9;//simuate some friction
if speed<0.5 speed=0;
Collision Event with object obj_hole:
execute code:
if speed<1//check if over hole and not too fast
{
show_message("you win");
game_restart();
}
Collision Event with object obj_wall:
execute code: move_bounce_solid(true);//bounce off of object
Draw Event:
execute code: draw_self(); draw_text(x,y-20,strength);//show strength near ball

0 Comments