SHOW:
|
|
- or go back to the newest paste.
| 1 | let x_speed = rand(-3, 3); | |
| 2 | let y_speed = 0; | |
| 3 | let gravity_strength = 0.02; | |
| 4 | ||
| 5 | while(!Obj_BeDeleted(balloon)){
| |
| 6 | let old_x = Obj_GetX(balloon); | |
| 7 | let old_y = Obj_GetY(balloon); | |
| 8 | let new_x = old_x + x_speed; | |
| 9 | let new_y = old_y + y_speed; | |
| 10 | let new_angle = atan2(new_y-old_y, new_x-old_x); | |
| 11 | ||
| 12 | Obj_SetPosition(balloon, new_x, new_y); | |
| 13 | Obj_SetAngle(balloon, new_angle); | |
| 14 | ||
| 15 | if(/*balloon hits floor*/){ y_speed *= -1; }
| |
| 16 | y_speed += gravity_strength; | |
| 17 | ||
| 18 | yield; | |
| 19 | } |