Some fixes on Coin files

This commit is contained in:
Martin Araneda 2022-06-06 20:59:51 -04:00
parent 20e2fafcf4
commit 5fe9e3340a
4 changed files with 11 additions and 7 deletions

View File

@ -17,7 +17,7 @@ region = Rect2( 18, 0, 18, 18 )
animations = [ {
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
"loop": true,
"name": "default",
"name": "spin",
"speed": 5.0
} ]
@ -30,6 +30,6 @@ shape = SubResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 4 )
frame = 1
animation = "spin"
playing = true
centered = false

View File

@ -1,4 +1,4 @@
#include "player/states/CoinNotCollected.h"
#include "Coin/CoinNotCollected.h"
using namespace godot;
@ -25,15 +25,17 @@ void CoinNotCollected::_init()
void CoinNotCollected::_state_enter()
{
animated_sprite = get_parent()->get_node<AnimatedSprite>("AnimatedSprite");
animated_sprite->stop();
animated_sprite->set_animation("idle");
animated_sprite->set_animation("spin");
animated_sprite->play();
}
void CoinNotCollected::_state_exit()
{
}
void CoinNotCollected::_physics_process(float delta)
{
}

View File

@ -1,5 +1,5 @@
#ifndef JUEGO_COIN_COINNOTCOLLECTED
#define JJUEGO_COIN_COINNOTCOLLECTED
#define JUEGO_COIN_COINNOTCOLLECTED
#include "state_machine/State.h"

View File

@ -9,6 +9,7 @@
#include "player/states/PlayerMove.h"
#include "player/states/PlayerJump.h"
#include "player/states/PlayerFall.h"
#include "Coin/CoinNotCollected.h"
using namespace godot;
@ -49,4 +50,5 @@ extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
register_class<player::PlayerMove>();
register_class<player::PlayerJump>();
register_class<player::PlayerFall>();
register_class<coin::CoinNotCollected>();
}