Vore_Sandbox_Remaster/scripts/poo.gd

29 lines
582 B
GDScript

extends KinematicBody2D
class_name Poo
var velocity = Vector2(0,0)
const JUMPF = -600
const GRAVITY = 30
var landed:bool = false
func _ready():
$Polygon2D.visible = true
$body.visible = false
func _physics_process(delta):
velocity.y += GRAVITY
velocity = move_and_slide(velocity,Vector2.UP)
if position.y > 20000:
queue_free()
if is_on_floor() and not landed:
velocity = Vector2.ZERO
$Polygon2D.queue_free()
$body.visible = true
landed = true
if is_on_floor():
velocity = Vector2.ZERO
if not landed:
$Polygon2D.rotation = velocity.angle() + deg2rad(90)