Fronter/Prison.gd

39 lines
712 B
GDScript3
Raw Normal View History

extends "res://Bad.gd"
func _ready():
health = 500
speed = 50
pass
signal health_up
var centered_x = false
var centered_y = false
func _process(delta):
if health < 200:
speed = 0
$StarSprite.frame = 1
$MainSprite.visible = false
$CollisionBox.disabled = true
if centered_x && centered_y:
$StarSprite.rotation += delta*10
position.x -= delta*500
if position.x < 0:
emit_signal("health_up", 200)
queue_free()
if position.x < 500:
position.x += delta*100
elif position.x > 524:
position.x -= delta*100
else:
centered_x = true
if position.y < 280:
position.y += delta*100
elif position.y > 320:
position.y -= delta*100
else:
centered_y = true