develop #34

Merged
cromer merged 36 commits from develop into master 2022-08-28 01:13:46 -04:00
3 changed files with 154 additions and 1 deletions
Showing only changes of commit 3a58777773 - Show all commits

View File

@ -1,10 +1,14 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1] [ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2] [ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://levels/Prototype.tmx" type="PackedScene" id=3] [ext_resource path="res://levels/Prototype.tmx" type="PackedScene" id=3]
[ext_resource path="res://assets/backgrounds/mountains.png" type="Texture" id=4] [ext_resource path="res://assets/backgrounds/mountains.png" type="Texture" id=4]
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=5] [ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/coin.png" type="Texture" id=6]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 0, 0, 0.541176 )
[node name="Prototype" type="Node2D"] [node name="Prototype" type="Node2D"]
@ -47,3 +51,35 @@ position = Vector2( 72, 450 )
[node name="coin2" parent="." instance=ExtResource( 5 )] [node name="coin2" parent="." instance=ExtResource( 5 )]
position = Vector2( 234, 450 ) position = Vector2( 234, 450 )
[node name="CoinHUD" type="CanvasLayer" parent="."]
[node name="Panel" type="Panel" parent="CoinHUD"]
margin_left = 144.0
margin_top = 18.0
margin_right = 288.0
margin_bottom = 54.0
custom_styles/panel = SubResource( 1 )
[node name="TextureRect" type="TextureRect" parent="CoinHUD"]
margin_left = 144.0
margin_top = 18.0
margin_right = 184.0
margin_bottom = 58.0
texture = ExtResource( 6 )
[node name="Label" type="Label" parent="CoinHUD"]
margin_left = 198.0
margin_top = 18.0
margin_right = 238.0
margin_bottom = 36.0
text = "X"
[node name="Coins" type="Label" parent="CoinHUD"]
margin_left = 216.0
margin_top = 18.0
margin_right = 256.0
margin_bottom = 32.0
text = "##"
[connection signal="ready" from="CoinHUD/Coins" to="Player" method="_on_CoinHUD_ready"]

View File

@ -0,0 +1,40 @@
#include "coin/CoinCounter.h"
#include <Control.hpp>
using namespace godot;
void CoinCounter::_register_methods()
{
register_method("_state_enter", &CoinCounter::_state_enter);
register_method("_state_exit", &CoinCounter::_state_exit);
register_method("_on_body_entered", &CoinCounter::_on_CoinHUD_ready);
}
CoinCounter::CoinCounter()
{
}
CoinCounter::~CoinCounter()
{
}
void CoinCounter::_init()
{
}
void CoinCounter::_state_enter()
{
}
void CoinCounter::_state_exit()
{
}
void CoinCounter::_on_CoinHUD_ready()
{
}

View File

@ -0,0 +1,77 @@
#ifndef ALAI_COIN_COUNTER
#define ALAI_COIN_COUNTER
#include "state_machine/State.h"
#include <Godot.hpp>
#include <Node.hpp>
#include <AnimatedSprite.hpp>
namespace godot
{
/**
* @brief This class controls what happens when the Coin is in the collected state.
*
*/
class CoinCounter : public State
{
GODOT_CLASS(CoinCounter, State)
private:
/**
* @brief The animated sprite of the Coin.
*
*/
AnimatedSprite *animated_sprite;
public:
/**
* @brief This method registers classes with Godot.
*
* @details This method registers methods, properties, and signals with the Godot engine.
*/
static void _register_methods();
/**
* @brief Construct a new CoinCounter object.
*
*/
CoinCounter();
/**
* @brief Destroy the CoinCounter object.
*
*/
~CoinCounter();
/**
* @brief Initialize the class from Godot.
*
* @details This method is called just once when the Godot engine connects to the instance of the class.
*/
void _init();
/**
* @brief Called when the collected state of the coin is entered.
*
*/
void _state_enter();
/**
* @brief Called when the collected state of the coin is exited.
*
*/
void _state_exit();
/**
* @brief Called when the animation of the collected coin has finished.
*
*/
void _on_CoinHUD_ready();
};
}
#endif