mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
34 lines
844 B
C#
34 lines
844 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class SpineboyInput : SpineSprite
|
|
{
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready()
|
|
{
|
|
GetAnimationState().SetAnimation("idle", true, 0);
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
if (Input.IsActionJustPressed("ui_left"))
|
|
{
|
|
GetAnimationState().SetAnimation("run", true, 0);
|
|
GetSkeleton().SetScaleX(-1);
|
|
}
|
|
|
|
if (Input.IsActionJustReleased("ui_left"))
|
|
GetAnimationState().SetAnimation("idle", true, 0);
|
|
|
|
if (Input.IsActionJustPressed("ui_right"))
|
|
{
|
|
GetAnimationState().SetAnimation("run", true, 0);
|
|
GetSkeleton().SetScaleX(1);
|
|
}
|
|
|
|
if (Input.IsActionJustReleased("ui_right"))
|
|
GetAnimationState().SetAnimation("idle", true, 0);
|
|
}
|
|
}
|