Godot nuked my changes
This commit is contained in:
parent
84f07fde20
commit
815812863e
1 changed files with 27 additions and 9 deletions
|
|
@ -7,27 +7,45 @@ var eat_interval : float = 3.0
|
|||
var eat_timer : float = 0.0
|
||||
|
||||
var move_to : Vector2 = Vector2.ZERO
|
||||
var speed : float = 20.0
|
||||
|
||||
var original_snail_scale : float = 0.1
|
||||
|
||||
func enter(_msg : Dictionary = {}) -> void:
|
||||
Log.pr("I am a snail and I will eat!")
|
||||
snail.eating = true
|
||||
if snail.animation:
|
||||
snail.animation.play("Move")
|
||||
|
||||
snail.hide_zeds()
|
||||
|
||||
func exit() -> void:
|
||||
snail.eating = false
|
||||
snail.sprite.flip_h = false
|
||||
|
||||
func update(_delta : float) -> void:
|
||||
eat_timer += _delta
|
||||
|
||||
if move_to == Vector2.ZERO:
|
||||
move_to = snail.get_random_target()
|
||||
snail.look_at(move_to)
|
||||
snail.move_to(move_to, speed)
|
||||
func update(delta : float) -> void:
|
||||
eat_timer += delta
|
||||
|
||||
if eat_timer >= eat_interval:
|
||||
snail.eat()
|
||||
eat_timer = 0.0
|
||||
|
||||
func physics_update(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
if move_to == Vector2.ZERO:
|
||||
move_to = snail.get_random_target()
|
||||
|
||||
if snail.global_position.distance_to(move_to) > 3:
|
||||
|
||||
snail.velocity = snail.global_position.direction_to(move_to) * snail.speed
|
||||
|
||||
if move_to.x > snail.global_position.x:
|
||||
snail.sprite.scale.x = original_snail_scale
|
||||
else:
|
||||
snail.sprite.scale.x = -original_snail_scale
|
||||
|
||||
snail.move_and_slide()
|
||||
else:
|
||||
move_to = Vector2.ZERO
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue