You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
589 B
GDScript
18 lines
589 B
GDScript
3 years ago
|
extends Node
|
||
|
class_name PlayerStanding
|
||
|
|
||
|
func run(actor, delta):
|
||
|
|
||
|
actor.getAnimatedSprite().animation = "standing up"
|
||
|
actor.getAnimatedSprite().speed_scale = 1
|
||
|
var velocity = Vector2(0.0, 0.0)
|
||
|
actor.position += velocity.normalized() * delta
|
||
|
actor.position.x = clamp(actor.position.x, 0, actor.get_viewport_rect().size.x)
|
||
|
actor.position.y = clamp(actor.position.y, 0, actor.get_viewport_rect().size.y)
|
||
|
actor.getAnimatedSprite().flip_h = actor.last_process_velocity.x < 0
|
||
|
|
||
|
func spriteFinished(actor):
|
||
|
|
||
|
actor.state = actor.PlayerState.NORMAL
|
||
|
actor.getAnimatedSprite().flip_h = false
|