From 5fe9e3340af57ff911084a4c3b024e739075ee36 Mon Sep 17 00:00:00 2001 From: Martin Araneda Date: Mon, 6 Jun 2022 20:59:51 -0400 Subject: [PATCH] Some fixes on Coin files --- godot/Collectables/Coin/Coin.tscn | 4 ++-- src/Coin/CoinNotCollected.cpp | 10 ++++++---- src/Coin/CoinNotCollected.h | 2 +- src/godot.cpp | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/godot/Collectables/Coin/Coin.tscn b/godot/Collectables/Coin/Coin.tscn index c4b9f4f..d496232 100644 --- a/godot/Collectables/Coin/Coin.tscn +++ b/godot/Collectables/Coin/Coin.tscn @@ -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 diff --git a/src/Coin/CoinNotCollected.cpp b/src/Coin/CoinNotCollected.cpp index 92d702e..41a4732 100644 --- a/src/Coin/CoinNotCollected.cpp +++ b/src/Coin/CoinNotCollected.cpp @@ -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"); - 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) { - + } + diff --git a/src/Coin/CoinNotCollected.h b/src/Coin/CoinNotCollected.h index d634de2..ab4488f 100644 --- a/src/Coin/CoinNotCollected.h +++ b/src/Coin/CoinNotCollected.h @@ -1,5 +1,5 @@ #ifndef JUEGO_COIN_COINNOTCOLLECTED -#define JJUEGO_COIN_COINNOTCOLLECTED +#define JUEGO_COIN_COINNOTCOLLECTED #include "state_machine/State.h" diff --git a/src/godot.cpp b/src/godot.cpp index 1c56d09..481a009 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -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(); register_class(); register_class(); + register_class(); }