feature/Coin #32
@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Main.gdns" type="Script" id=1]
|
[ext_resource path="res://Main.gdns" type="Script" id=1]
|
||||||
[ext_resource path="res://levels/Prototype.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://levels/Prototype.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://GUI/GameOver.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
@ -10,3 +11,6 @@ level = ExtResource( 2 )
|
|||||||
|
|
||||||
[node name="Level" type="Node" parent="."]
|
[node name="Level" type="Node" parent="."]
|
||||||
pause_mode = 1
|
pause_mode = 1
|
||||||
|
|
||||||
|
[node name="GameOver" parent="." instance=ExtResource( 3 )]
|
||||||
|
visible = false
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
#include "gui/game_over/GameOverScreen.h"
|
#include "gui/game_over/GameOverScreen.h"
|
||||||
|
#include <Resource.hpp>
|
||||||
|
#include <Ref.hpp>
|
||||||
#include <Node.hpp>
|
#include <Node.hpp>
|
||||||
#include <SceneTree.hpp>
|
#include <SceneTree.hpp>
|
||||||
|
#include <PackedScene.hpp>
|
||||||
|
#include <Viewport.hpp>
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
void GameOverScreen::_register_methods()
|
void GameOverScreen::_register_methods()
|
||||||
{
|
{
|
||||||
register_method("_on_restart_button_pressed", &GameOverScreen::_on_restart_button_pressed);
|
register_method("_on_animation_finished", &GameOverScreen::_on_botonreiniciar_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameOverScreen::GameOverScreen()
|
GameOverScreen::GameOverScreen()
|
||||||
@ -19,9 +23,20 @@ GameOverScreen::~GameOverScreen()
|
|||||||
|
|
||||||
void GameOverScreen::_init()
|
void GameOverScreen::_init()
|
||||||
{
|
{
|
||||||
|
_resource_loader = ResourceLoader::get_singleton();
|
||||||
|
|
||||||
}
|
}
|
||||||
void GameOverScreen::_on_restart_button_pressed()
|
|
||||||
|
void GameOverScreen::_on_botonreiniciar_pressed()
|
||||||
{
|
{
|
||||||
get_tree()->change_scene("res://monitor/GUI.tscn");
|
|
||||||
|
if (_resource_loader->exists("res://levels/Prototype.tscn")) //CAMBIAR A DINAMICO
|
||||||
|
{
|
||||||
|
Ref<PackedScene> level_scene = _resource_loader->load("res://levels/Prototype.tscn");
|
||||||
|
auto level = level_scene->instance();
|
||||||
|
auto level_node = get_tree()->get_root()->find_node("Level");
|
||||||
|
level_node->add_child(level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,56 +1,60 @@
|
|||||||
#ifndef ALAI_GAME_OVER_SCREEN
|
#ifndef ALAI_GAME_OVER_SCREEN_H
|
||||||
#define ALAI_GAME_OVER_SCREEN
|
#define ALAI_GAME_OVER_SCREEN_H
|
||||||
|
|
||||||
|
|
||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <Node.hpp>
|
|
||||||
#include <Control.hpp>
|
#include <Control.hpp>
|
||||||
|
#include <ResourceLoader.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace godot
|
namespace godot
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief This class controls what happens when the Coin is in the collected .
|
* @brief This class controls what happens when the Coin is in the collected .
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class GameOverScreen : public Control
|
class GameOverScreen : public Control
|
||||||
{
|
{
|
||||||
GODOT_CLASS(GameOverScreen, Control)
|
GODOT_CLASS(GameOverScreen, Control)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ResourceLoader *_resource_loader;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief This method registers classes with Godot.
|
* @brief This method registers classes with Godot.
|
||||||
*
|
*
|
||||||
* @details This method registers methods, properties, and signals with the Godot engine.
|
* @details This method registers methods, properties, and signals with the Godot engine.
|
||||||
*/
|
*/
|
||||||
static void _register_methods();
|
static void _register_methods();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new GameOverScreen object.
|
* @brief Construct a new GameOverScreen object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
GameOverScreen();
|
GameOverScreen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the GameOverScreen object.
|
* @brief Destroy the GameOverScreen object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
~GameOverScreen();
|
~GameOverScreen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the class from Godot.
|
* @brief Initialize the class from Godot.
|
||||||
*
|
*
|
||||||
* @details This method is called just once when the Godot engine connects to the instance of the class.
|
* @details This method is called just once when the Godot engine connects to the instance of the class.
|
||||||
*/
|
*/
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Called when the collected of the coin is entered.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void _on_botonreiniciar_pressed();
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Called when the collected of the coin is entered.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void _on_restart_button_pressed();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user