Bottle.gd 326 B

12345678910111213141516171819
  1. extends KinematicBody2D
  2. var gravity = 35
  3. var Velocity = Vector2.ZERO
  4. var max_speed = 450
  5. var is_stop = false
  6. func _physics_process(delta):
  7. if is_stop:
  8. return
  9. Velocity.y += gravity
  10. Velocity.y = clamp(Velocity.y, -max_speed, max_speed)
  11. Velocity = move_and_slide(Velocity)
  12. func initialize(pos):
  13. global_position = pos