Merge pull request 'develop' (#55) from develop into master

Reviewed-on: #55
This commit is contained in:
Chris Cromer 2022-10-10 21:57:13 -03:00
commit 298a21d516
36 changed files with 390 additions and 168 deletions

220
.clang-format Normal file
View File

@ -0,0 +1,220 @@
---
AccessModifierOffset: 0
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
IndentAccessModifiers: true
TabWidth: 4
UseTab: Never
UseCRLF: false
Language: Cpp
IndentWidth: 4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: AcrossComments
AlignConsecutiveBitFields: AcrossComments
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: AcrossComments
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: No
BinPackArguments: false
BinPackParameters: false
AttributeMacros:
- __capability
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: false
ColumnLimit: 0
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: ^<ext/.*\.h>
Priority: 2
CaseSensitive: false
SortPriority: 0
- Regex: ^<.*\.h>
Priority: 1
CaseSensitive: false
SortPriority: 0
- Regex: ^<.*
Priority: 2
CaseSensitive: false
SortPriority: 0
- Regex: .*
Priority: 0
CaseSensitive: false
SortPriority: 0
IncludeIsMainRegex: ([-_](test|unittest))?$
IncludeIsMainSourceRegex: ""
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: Indent
IndentGotoLabels: false
IndentPPDirectives: BeforeHash
IndentRequires: true
IndentWrappedFunctionNames: true
InsertTrailingCommas: None
JavaScriptQuotes: Double
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: OuterScope
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: false
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PPIndentWidth: 4
PackConstructorInitializers: Never
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
QualifierAlignment: Left
RawStringFormats:
- Language: Cpp
BasedOnStyle: google
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- c++
- C++
CanonicalDelimiter: ""
- Language: TextProto
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
BasedOnStyle: google
Delimiters:
- pb
- PB
- proto
- PROTO
CanonicalDelimiter: pb
ReferenceAlignment: Left
ReflowComments: false
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 0
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: false
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: false
AfterOverloadedOperator: true
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME

View File

@ -8,7 +8,7 @@
[node name="Main" type="Node"] [node name="Main" type="Node"]
pause_mode = 2 pause_mode = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
game_version = "1.0.0" game_version = "1.1.0"
level = ExtResource( 2 ) level = ExtResource( 2 )
[node name="Level" type="Node" parent="."] [node name="Level" type="Node" parent="."]

View File

@ -2,6 +2,7 @@ extends Node
export var monitor_enabled: bool = false export var monitor_enabled: bool = false
export var anonymous: bool = true
export var debug: bool = false export var debug: bool = false
export var development_url: String = "http://localhost:4050/api/v1" export var development_url: String = "http://localhost:4050/api/v1"
var url_real: String = "https://alai.cromer.cl/api/v1" var url_real: String = "https://alai.cromer.cl/api/v1"
@ -58,9 +59,10 @@ func _ready() -> void:
game_version = get_parent().game_version game_version = get_parent().game_version
player["rut"] = "" if not anonymous:
player["name"] = "" player["rut"] = ""
player["email"] = "" player["name"] = ""
player["email"] = ""
var os_name = OS.get_name() var os_name = OS.get_name()
if os_name == "Android": if os_name == "Android":
@ -82,7 +84,8 @@ func _ready() -> void:
else: else:
os_id = 0 os_id = 0
game["player"] = player if not anonymous:
game["player"] = player
game["level_id"] = 0 game["level_id"] = 0
game["os_id"] = os_id game["os_id"] = os_id
game["godot_version"] = godot_version game["godot_version"] = godot_version
@ -108,9 +111,15 @@ func _ready() -> void:
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
if monitor_enabled: if monitor_enabled:
if has_node("MonitorGUI") and not $MonitorGUI.visible: if anonymous and has_node("MonitorGUI"):
$MonitorGUI.visible = true $MonitorGUI.queue_free()
Event.emit_signal("monitor_loaded") Event.emit_signal("monitor_loaded")
get_tree().paused = false
start_monitor()
else:
if has_node("MonitorGUI") and not $MonitorGUI.visible:
$MonitorGUI.visible = true
Event.emit_signal("monitor_loaded")
if started and not get_tree().paused: if started and not get_tree().paused:
var frame = empty_frame.duplicate(true) var frame = empty_frame.duplicate(true)
@ -124,11 +133,11 @@ func _physics_process(_delta: float) -> void:
frames.append(frame) frames.append(frame)
if Input.is_action_just_pressed("Send"): if debug and Input.is_action_just_pressed("Send"):
stop_monitor() stop_monitor()
send_data() send_data()
else: else:
if Input.is_action_just_pressed("Send"): if debug and Input.is_action_just_pressed("Send"):
start_monitor() start_monitor()
else: else:
get_tree().paused = false get_tree().paused = false
@ -137,11 +146,13 @@ func _physics_process(_delta: float) -> void:
func _on_input_validated(validated_player: Dictionary) -> void: func _on_input_validated(validated_player: Dictionary) -> void:
$MonitorGUI.queue_free() if not anonymous:
get_tree().paused = false $MonitorGUI.queue_free()
Event.emit_signal("game_started") get_tree().paused = false
player = validated_player.duplicate(true) Event.emit_signal("game_started")
game["player"] = player player = validated_player.duplicate(true)
game["player"] = player
start_monitor()
func _object_created(name: String, state: String, position: Vector2, velocity: Vector2) -> void: func _object_created(name: String, state: String, position: Vector2, velocity: Vector2) -> void:

View File

@ -24,14 +24,14 @@ void alai::CameraLimit::_init()
void alai::CameraLimit::_ready() void alai::CameraLimit::_ready()
{ {
auto node = find_node("Middleground"); auto node = find_node("Middleground");
auto middle_ground = cast_to<godot::TileMap>(node); auto middle_ground = cast_to<godot::TileMap>(node);
if (middle_ground != NULL) if (middle_ground != NULL)
{ {
auto used_rect = middle_ground->get_used_rect(); auto used_rect = middle_ground->get_used_rect();
auto bounds = godot::Vector2(used_rect.position.x + used_rect.size.x, used_rect.position.y + used_rect.size.y); auto bounds = godot::Vector2(used_rect.position.x + used_rect.size.x, used_rect.position.y + used_rect.size.y);
node = get_tree()->get_root()->find_node("Camera2D", true, false); node = get_tree()->get_root()->find_node("Camera2D", true, false);
auto camera = cast_to<godot::Camera2D>(node); auto camera = cast_to<godot::Camera2D>(node);
if (camera != NULL) if (camera != NULL)
{ {
camera->set_limit(2, bounds.x * middle_ground->get_cell_size().x); camera->set_limit(2, bounds.x * middle_ground->get_cell_size().x);

View File

@ -11,9 +11,9 @@ namespace alai
* *
* @details The camera will be limited based on the used width and height of the Middleground tilemap. * @details The camera will be limited based on the used width and height of the Middleground tilemap.
*/ */
class CameraLimit: public godot::Node2D class CameraLimit : public godot::Node2D
{ {
GODOT_CLASS(CameraLimit, godot::Node2D) GODOT_CLASS(CameraLimit, godot::Node2D)
public: public:
/** /**
@ -49,5 +49,5 @@ namespace alai
*/ */
void _ready(); void _ready();
}; };
} } // namespace alai
#endif #endif

View File

@ -12,7 +12,6 @@ void alai::Event::_register_methods()
godot::register_signal<Event>("player_died"); godot::register_signal<Event>("player_died");
godot::register_signal<Event>("player_won"); godot::register_signal<Event>("player_won");
godot::register_signal<Event>("player_touched", "damage", GODOT_VARIANT_TYPE_INT); godot::register_signal<Event>("player_touched", "damage", GODOT_VARIANT_TYPE_INT);
} }
alai::Event::Event() alai::Event::Event()

View File

@ -14,7 +14,8 @@ namespace alai
*/ */
class Event : public godot::Node class Event : public godot::Node
{ {
GODOT_CLASS(Event, godot::Node) GODOT_CLASS(Event, godot::Node)
public: public:
/** /**
* @brief This method registers classes with Godot. * @brief This method registers classes with Godot.
@ -42,6 +43,6 @@ namespace alai
*/ */
void _init(); void _init();
}; };
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "Main.h"
#include "Event.h" #include "Event.h"
#include "Main.h"
#include <SceneTree.hpp> #include <SceneTree.hpp>
@ -27,10 +26,10 @@ alai::Main::~Main()
void alai::Main::_init() void alai::Main::_init()
{ {
_os = godot::OS::get_singleton(); _os = godot::OS::get_singleton();
_input = godot::Input::get_singleton(); _input = godot::Input::get_singleton();
_project_settings = godot::ProjectSettings::get_singleton(); _project_settings = godot::ProjectSettings::get_singleton();
_resource_loader = godot::ResourceLoader::get_singleton(); _resource_loader = godot::ResourceLoader::get_singleton();
set_game_version(godot::String(default_game_version.c_str())); set_game_version(godot::String(default_game_version.c_str()));
set_full_screen(default_full_screen); set_full_screen(default_full_screen);
@ -66,8 +65,7 @@ void alai::Main::_ready()
{ {
_os->set_window_size(window_size); _os->set_window_size(window_size);
_os->set_window_position( _os->set_window_position(
_os->get_screen_position(get_launch_screen()) + _os->get_screen_size() * 0.5 - _os->get_window_size() * 0.5 _os->get_screen_position(get_launch_screen()) + _os->get_screen_size() * 0.5 - _os->get_window_size() * 0.5);
);
} }
success = _project_settings->load_resource_pack("crt.pck"); success = _project_settings->load_resource_pack("crt.pck");
@ -106,9 +104,9 @@ void alai::Main::load_level()
{ {
if (level != nullptr) if (level != nullptr)
{ {
auto path = level->get_path(); auto path = level->get_path();
auto loaded_level = level->instance(); auto loaded_level = level->instance();
auto level_node = get_node("Level"); auto level_node = get_node("Level");
level_node->add_child(loaded_level); level_node->add_child(loaded_level);
} }
} }
@ -153,7 +151,7 @@ bool alai::Main::get_full_screen()
void alai::Main::set_window_size(godot::Vector2 window_size) void alai::Main::set_window_size(godot::Vector2 window_size)
{ {
this-> window_size = window_size; this->window_size = window_size;
} }
godot::Vector2 alai::Main::get_window_size() godot::Vector2 alai::Main::get_window_size()

View File

@ -1,7 +1,6 @@
#ifndef ALAI_MAIN_H #ifndef ALAI_MAIN_H
#define ALAI_MAIN_H #define ALAI_MAIN_H
#include <string>
#include <Godot.hpp> #include <Godot.hpp>
#include <Input.hpp> #include <Input.hpp>
#include <Node.hpp> #include <Node.hpp>
@ -10,6 +9,7 @@
#include <ProjectSettings.hpp> #include <ProjectSettings.hpp>
#include <Ref.hpp> #include <Ref.hpp>
#include <ResourceLoader.hpp> #include <ResourceLoader.hpp>
#include <string>
/** /**
* @brief This is the alai namespace for all the code included in the game. * @brief This is the alai namespace for all the code included in the game.
@ -25,7 +25,7 @@ namespace alai
*/ */
class Main : public godot::Node class Main : public godot::Node
{ {
GODOT_CLASS(Main, godot::Node) GODOT_CLASS(Main, godot::Node)
private: private:
/** /**
@ -52,12 +52,12 @@ namespace alai
* @brief The default value for the game version. * @brief The default value for the game version.
* *
*/ */
inline static const std::string default_game_version = "0.1.0"; inline static const std::string default_game_version = "0.1.0";
/** /**
* @brief The default value for if the game should start in full screen. * @brief The default value for if the game should start in full screen.
* *
*/ */
inline static const bool default_full_screen = false; inline static const bool default_full_screen = false;
/** /**
* @brief The default resolution for the game window. * @brief The default resolution for the game window.
* *
@ -68,7 +68,7 @@ namespace alai
* *
* @details -1 opens it on the currently active screen. And 0 and above are the screens to use. * @details -1 opens it on the currently active screen. And 0 and above are the screens to use.
*/ */
inline static const int8_t default_launch_screen = -1; inline static const int8_t default_launch_screen = -1;
/** /**
* @brief The first level to load * @brief The first level to load
* *
@ -227,6 +227,6 @@ namespace alai
*/ */
void load_level(); void load_level();
}; };
} } // namespace alai
#endif #endif

View File

@ -1,9 +1,8 @@
#include "Event.h"
#include "coin/CoinCollected.h" #include "coin/CoinCollected.h"
#include "Event.h"
#include <AudioStreamPlayer.hpp>
#include <AnimationPlayer.hpp> #include <AnimationPlayer.hpp>
#include <AudioStreamPlayer.hpp>
void alai::CoinCollected::_register_methods() void alai::CoinCollected::_register_methods()
{ {

View File

@ -14,7 +14,7 @@ namespace alai
*/ */
class CoinCollected : public alai::State class CoinCollected : public alai::State
{ {
GODOT_CLASS(CoinCollected, alai::State) GODOT_CLASS(CoinCollected, alai::State)
private: private:
/** /**
@ -68,6 +68,6 @@ namespace alai
*/ */
void _on_animation_finished(godot::String anim_name); void _on_animation_finished(godot::String anim_name);
}; };
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "coin/CoinCounter.h"
#include "Event.h" #include "Event.h"
#include "coin/CoinCounter.h"
#include <String.hpp> #include <String.hpp>
@ -36,14 +35,15 @@ void alai::CoinCounter::_on_coin_collected(int amount)
if (coins >= 100) if (coins >= 100)
{ {
auto extra = coins - 100; auto extra = coins - 100;
coins = extra; coins = extra;
} }
godot::String coin_string = godot::String(); godot::String coin_string = godot::String();
if (coins <= 9) if (coins <= 9)
{ {
coin_string = "0" + godot::String::num(coins); coin_string = "0" + godot::String::num(coins);
} }
else{ else
{
coin_string = godot::String::num(coins); coin_string = godot::String::num(coins);
} }
set_text(coin_string); set_text(coin_string);

View File

@ -12,7 +12,7 @@ namespace alai
*/ */
class CoinCounter : public godot::Label class CoinCounter : public godot::Label
{ {
GODOT_CLASS(CoinCounter, godot::Label) GODOT_CLASS(CoinCounter, godot::Label)
private: private:
uint8_t coins; uint8_t coins;
@ -52,9 +52,8 @@ namespace alai
void _on_CoinHUD_ready(); void _on_CoinHUD_ready();
void _on_coin_collected(int amount); void _on_coin_collected(int amount);
void _ready(); void _ready();
}; };
} } // namespace alai
#endif #endif

View File

@ -41,6 +41,6 @@ void alai::CoinNotCollected::_on_body_entered(Node *node)
auto coin = Object::cast_to<godot::Area2D>(parent_node); auto coin = Object::cast_to<godot::Area2D>(parent_node);
coin->set_collision_mask_bit(0, false); coin->set_collision_mask_bit(0, false);
} }
get_state_machine()->change("CoinCollected"); get_state_machine()->change("CoinCollected");
} }

View File

@ -14,7 +14,7 @@ namespace alai
*/ */
class CoinNotCollected : public alai::State class CoinNotCollected : public alai::State
{ {
GODOT_CLASS(CoinNotCollected, alai::State) GODOT_CLASS(CoinNotCollected, alai::State)
private: private:
/** /**
@ -69,6 +69,6 @@ namespace alai
*/ */
void _on_body_entered(Node *node); void _on_body_entered(Node *node);
}; };
} } // namespace alai
#endif #endif

View File

@ -14,7 +14,7 @@ namespace alai
*/ */
class GoalNotReached : public alai::State class GoalNotReached : public alai::State
{ {
GODOT_CLASS(GoalNotReached, alai::State) GODOT_CLASS(GoalNotReached, alai::State)
private: private:
/** /**
@ -69,6 +69,6 @@ namespace alai
*/ */
void _on_Goal_body_entered(Node *node); void _on_Goal_body_entered(Node *node);
}; };
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "goal/GoalReached.h"
#include "Event.h" #include "Event.h"
#include "goal/GoalReached.h"
#include <Area2D.hpp> #include <Area2D.hpp>

View File

@ -14,7 +14,7 @@ namespace alai
*/ */
class GoalReached : public alai::State class GoalReached : public alai::State
{ {
GODOT_CLASS(GoalReached, alai::State) GODOT_CLASS(GoalReached, alai::State)
private: private:
/** /**
@ -67,6 +67,6 @@ namespace alai
* *
*/ */
}; };
} } // namespace alai
#endif #endif

View File

@ -1,22 +1,22 @@
#include <Godot.hpp>
#include "Event.h"
#include "state_machine/StateMachine.h"
#include "state_machine/State.h"
#include "Main.h"
#include "CameraLimit.h" #include "CameraLimit.h"
#include "player/Player.h" #include "Event.h"
#include "player/states/PlayerIdle.h" #include "Main.h"
#include "player/states/PlayerMove.h"
#include "player/states/PlayerJump.h"
#include "player/states/PlayerFall.h"
#include "coin/CoinNotCollected.h"
#include "coin/CoinCollected.h" #include "coin/CoinCollected.h"
#include "coin/CoinCounter.h" #include "coin/CoinCounter.h"
#include "goal/GoalReached.h" #include "coin/CoinNotCollected.h"
#include "goal/GoalNotReached.h" #include "goal/GoalNotReached.h"
#include "goal/GoalReached.h"
#include "gui/game_over/GameOverScreen.h" #include "gui/game_over/GameOverScreen.h"
#include "gui/game_won/GameWonScreen.h" #include "gui/game_won/GameWonScreen.h"
#include "player/Player.h"
#include "player/states/PlayerFall.h"
#include "player/states/PlayerIdle.h"
#include "player/states/PlayerJump.h"
#include "player/states/PlayerMove.h"
#include "state_machine/State.h"
#include "state_machine/StateMachine.h"
#include <Godot.hpp>
/** /**
* @brief This function connects the gdnative init function. * @brief This function connects the gdnative init function.
@ -47,7 +47,7 @@ extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
{ {
godot::Godot::nativescript_init(handle); godot::Godot::nativescript_init(handle);
godot::register_class<alai::Event>(); godot::register_class<alai::Event>();
godot::register_class<alai::StateMachine>(); godot::register_class<alai::StateMachine>();
godot::register_class<alai::State>(); godot::register_class<alai::State>();
godot::register_class<alai::Main>(); godot::register_class<alai::Main>();

View File

@ -1,6 +1,5 @@
#include "gui/game_over/GameOverScreen.h"
#include "Event.h" #include "Event.h"
#include "gui/game_over/GameOverScreen.h"
#include <AudioStreamPlayer.hpp> #include <AudioStreamPlayer.hpp>
#include <PackedScene.hpp> #include <PackedScene.hpp>
@ -16,7 +15,7 @@ void alai::GameOverScreen::_register_methods()
godot::register_method("restart_game", &GameOverScreen::restart_game); godot::register_method("restart_game", &GameOverScreen::restart_game);
godot::register_method("connect_signal", &GameOverScreen::connect_signal); godot::register_method("connect_signal", &GameOverScreen::connect_signal);
godot::register_method("_on_player_died", &GameOverScreen::_on_player_died); godot::register_method("_on_player_died", &GameOverScreen::_on_player_died);
godot::register_method("_on_visibility_changed", &GameOverScreen::_on_visibility_changed); godot::register_method("_on_visibility_changed", &GameOverScreen::_on_visibility_changed);
} }
alai::GameOverScreen::GameOverScreen() alai::GameOverScreen::GameOverScreen()
@ -42,8 +41,8 @@ void alai::GameOverScreen::_on_restart_button_pressed()
if (_resource_loader->exists("res://levels/PrototypeR.tscn")) if (_resource_loader->exists("res://levels/PrototypeR.tscn"))
{ {
godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/PrototypeR.tscn"); godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/PrototypeR.tscn");
auto level = level_scene->instance(); auto level = level_scene->instance();
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level"); auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");
if (level_node != nullptr) if (level_node != nullptr)
{ {
@ -66,7 +65,7 @@ void alai::GameOverScreen::_on_player_died()
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level"); auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");
if (level_node != nullptr) if (level_node != nullptr)
{ {
auto child = level_node->get_child(0); auto child = level_node->get_child(0);
if (child != nullptr) if (child != nullptr)
{ {
// Delete the currently active level from the tree. // Delete the currently active level from the tree.
@ -99,8 +98,8 @@ void alai::GameOverScreen::connect_signal()
void alai::GameOverScreen::_on_visibility_changed() void alai::GameOverScreen::_on_visibility_changed()
{ {
auto gameoversound = get_node<godot::AudioStreamPlayer>("GameOverMusic"); auto gameoversound = get_node<godot::AudioStreamPlayer>("GameOverMusic");
if (is_visible()) if (is_visible())
{ {
gameoversound->play(); gameoversound->play();
} }
else else

View File

@ -5,7 +5,6 @@
#include <Godot.hpp> #include <Godot.hpp>
#include <ResourceLoader.hpp> #include <ResourceLoader.hpp>
namespace alai namespace alai
{ {
/** /**
@ -14,7 +13,7 @@ namespace alai
*/ */
class GameOverScreen : public godot::CanvasLayer class GameOverScreen : public godot::CanvasLayer
{ {
GODOT_CLASS(GameOverScreen, godot::CanvasLayer) GODOT_CLASS(GameOverScreen, godot::CanvasLayer)
private: private:
godot::ResourceLoader *_resource_loader; godot::ResourceLoader *_resource_loader;
@ -57,6 +56,6 @@ namespace alai
void connect_signal(); void connect_signal();
void _on_visibility_changed(); void _on_visibility_changed();
}; };
} } // namespace alai
#endif #endif

View File

@ -1,13 +1,12 @@
#include "gui/game_won/GameWonScreen.h"
#include "Event.h" #include "Event.h"
#include "gui/game_won/GameWonScreen.h"
#include <AudioStreamPlayer.hpp> #include <AudioStreamPlayer.hpp>
#include <SceneTree.hpp> #include <SceneTree.hpp>
#include <Viewport.hpp> #include <Viewport.hpp>
void alai::GameWonScreen::_register_methods() void alai::GameWonScreen::_register_methods()
{ {
godot::register_method("_ready", &GameWonScreen::_ready); godot::register_method("_ready", &GameWonScreen::_ready);
godot::register_method("connect_signal", &GameWonScreen::connect_signal); godot::register_method("connect_signal", &GameWonScreen::connect_signal);
godot::register_method("_on_player_won", &GameWonScreen::_on_player_won); godot::register_method("_on_player_won", &GameWonScreen::_on_player_won);
@ -45,7 +44,7 @@ void alai::GameWonScreen::_on_player_won()
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level"); auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");
if (level_node != nullptr) if (level_node != nullptr)
{ {
auto child = level_node->get_child(0); auto child = level_node->get_child(0);
if (child != nullptr) if (child != nullptr)
{ {
child->queue_free(); child->queue_free();
@ -70,8 +69,8 @@ void alai::GameWonScreen::connect_signal()
void alai::GameWonScreen::_on_visibility_changed() void alai::GameWonScreen::_on_visibility_changed()
{ {
auto victorysound = get_node<godot::AudioStreamPlayer>("VictorySound"); auto victorysound = get_node<godot::AudioStreamPlayer>("VictorySound");
if (is_visible()) if (is_visible())
{ {
victorysound->play(); victorysound->play();
} }
else else

View File

@ -12,7 +12,7 @@ namespace alai
*/ */
class GameWonScreen : public godot::CanvasLayer class GameWonScreen : public godot::CanvasLayer
{ {
GODOT_CLASS(GameWonScreen, godot::CanvasLayer) GODOT_CLASS(GameWonScreen, godot::CanvasLayer)
public: public:
/** /**
@ -47,6 +47,6 @@ namespace alai
void connect_signal(); void connect_signal();
void _on_visibility_changed(); void _on_visibility_changed();
}; };
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "player/Player.h"
#include "Event.h" #include "Event.h"
#include "player/Player.h"
#include <AudioStreamPlayer.hpp> #include <AudioStreamPlayer.hpp>
#include <Camera2D.hpp> #include <Camera2D.hpp>
@ -83,7 +82,8 @@ void alai::player::Player::_ready()
} }
} }
void alai::player::Player::_on_level_loaded() { void alai::player::Player::_on_level_loaded()
{
auto state = get_node("StateMachine")->get_child(0); auto state = get_node("StateMachine")->get_child(0);
if (state != nullptr) if (state != nullptr)
{ {
@ -106,27 +106,27 @@ void alai::player::Player::_physics_process(float delta)
snap_vector = godot::Vector2::DOWN * 20.0; snap_vector = godot::Vector2::DOWN * 20.0;
} }
auto is_on_platform = false; auto is_on_platform = false;
auto platform_detector = get_node<godot::RayCast2D>("PlatformDetector"); auto platform_detector = get_node<godot::RayCast2D>("PlatformDetector");
if (platform_detector != nullptr) if (platform_detector != nullptr)
{ {
is_on_platform = platform_detector->is_colliding(); is_on_platform = platform_detector->is_colliding();
} }
else else
{ {
WARN_PRINT("PlatformDetector not found!"); WARN_PRINT("PlatformDetector not found!");
} }
velocity = move_and_slide_with_snap(velocity, snap_vector, godot::Vector2::UP, !is_on_platform, 4, 0.9, false); velocity = move_and_slide_with_snap(velocity, snap_vector, godot::Vector2::UP, !is_on_platform, 4, 0.9, false);
//velocity = move_and_slide(velocity, Vector2::UP, !is_on_platform); //velocity = move_and_slide(velocity, Vector2::UP, !is_on_platform);
velocity.x = godot::Math::lerp((float) velocity.x, (float) 0, (float) 0.2); velocity.x = godot::Math::lerp((float) velocity.x, (float) 0, (float) 0.2);
auto count = get_slide_count(); auto count = get_slide_count();
for (int64_t i = 0; i < count; i++) for (int64_t i = 0; i < count; i++)
{ {
auto collision = get_slide_collision(i); auto collision = get_slide_collision(i);
auto collision_object = collision->get_collider(); auto collision_object = collision->get_collider();
auto collider = Object::cast_to<Node>(collision_object); auto collider = Object::cast_to<Node>(collision_object);
if (collider->is_in_group("squashable") && godot::Vector2::UP.dot(collision->get_normal()) > 0.1) if (collider->is_in_group("squashable") && godot::Vector2::UP.dot(collision->get_normal()) > 0.1)
{ {
collider->call_deferred("squash"); collider->call_deferred("squash");
@ -169,14 +169,15 @@ void alai::player::Player::_physics_process(float delta)
auto camera = get_node<godot::Camera2D>("Camera2D"); auto camera = get_node<godot::Camera2D>("Camera2D");
if (camera != nullptr) if (camera != nullptr)
{ {
auto position = get_global_position(); auto position = get_global_position();
auto sprite_node = get_node<godot::AnimatedSprite>("AnimatedSprite"); auto sprite_node = get_node<godot::AnimatedSprite>("AnimatedSprite");
if (sprite_node != nullptr) if (sprite_node != nullptr)
{ {
position.x = godot::Math::clamp((float) position.x, (float) camera->get_limit(0), (float) camera->get_limit(2) - sprite_node->get_sprite_frames()->get_frame("idle", 0)->get_size().x); position.x = godot::Math::clamp((float) position.x, (float) camera->get_limit(0), (float) camera->get_limit(2) - sprite_node->get_sprite_frames()->get_frame("idle", 0)->get_size().x);
position.y = godot::Math::clamp((float) position.y, (float) camera->get_limit(1), (float) camera->get_limit(3) + sprite_node->get_sprite_frames()->get_frame("idle", 0)->get_size().y); position.y = godot::Math::clamp((float) position.y, (float) camera->get_limit(1), (float) camera->get_limit(3) + sprite_node->get_sprite_frames()->get_frame("idle", 0)->get_size().y);
} }
else { else
{
WARN_PRINT("Could not clamp player based on sprite frame size!"); WARN_PRINT("Could not clamp player based on sprite frame size!");
position.x = godot::Math::clamp((float) position.x, (float) camera->get_limit(0), (float) camera->get_limit(2)); position.x = godot::Math::clamp((float) position.x, (float) camera->get_limit(0), (float) camera->get_limit(2));
position.y = godot::Math::clamp((float) position.y, (float) camera->get_limit(1), (float) camera->get_limit(3)); position.y = godot::Math::clamp((float) position.y, (float) camera->get_limit(1), (float) camera->get_limit(3));
@ -196,11 +197,13 @@ void alai::player::Player::_physics_process(float delta)
{ {
// The first time the notifier is checked always returns false in the first frame // The first time the notifier is checked always returns false in the first frame
// So skip the check from the first frame // So skip the check from the first frame
if (notifier_initialized) { if (notifier_initialized)
{
auto event = get_node<alai::Event>("/root/Event"); auto event = get_node<alai::Event>("/root/Event");
event->emit_signal("player_died"); event->emit_signal("player_died");
} }
else { else
{
notifier_initialized = true; notifier_initialized = true;
} }
} }

View File

@ -24,32 +24,32 @@ namespace alai
* @brief The default speed of the player. * @brief The default speed of the player.
* *
*/ */
const float speed = 60.0; const float speed = 60.0;
/** /**
* @brief The default jump force applied when jumping. * @brief The default jump force applied when jumping.
* *
*/ */
const float jump_force = 300.0; const float jump_force = 300.0;
/** /**
* @brief The default bounce force applied when bouncing on something. * @brief The default bounce force applied when bouncing on something.
* *
*/ */
const float bounce_force = 200.0; const float bounce_force = 200.0;
/** /**
* @brief The default gravity applied to the player. * @brief The default gravity applied to the player.
* *
*/ */
const float gravity = 9.81; const float gravity = 9.81;
/** /**
* @brief The default run speed multiplier. * @brief The default run speed multiplier.
* *
*/ */
const float run_speed = 2.0; const float run_speed = 2.0;
/** /**
* @brief The default double jump activation state. * @brief The default double jump activation state.
* *
*/ */
const bool double_jump = true; const bool double_jump = true;
/** /**
* @brief This class is used to control the player. * @brief This class is used to control the player.
@ -58,7 +58,7 @@ namespace alai
*/ */
class Player : public godot::KinematicBody2D class Player : public godot::KinematicBody2D
{ {
GODOT_CLASS(Player, godot::KinematicBody2D) GODOT_CLASS(Player, godot::KinematicBody2D)
private: private:
/** /**
@ -291,7 +291,7 @@ namespace alai
*/ */
void _on_level_loaded(); void _on_level_loaded();
}; };
} } // namespace player
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "player/states/PlayerFall.h"
#include "player/Player.h" #include "player/Player.h"
#include "player/states/PlayerFall.h"
void alai::player::PlayerFall::_register_methods() void alai::player::PlayerFall::_register_methods()
{ {
@ -46,8 +45,8 @@ void alai::player::PlayerFall::_physics_process(float delta)
} }
auto current_speed = parent->get_speed(); auto current_speed = parent->get_speed();
auto velocity = parent->get_velocity(); auto velocity = parent->get_velocity();
velocity.x = 0; velocity.x = 0;
if (_input->is_action_pressed("run")) if (_input->is_action_pressed("run"))
{ {
current_speed *= parent->get_run_speed(); current_speed *= parent->get_run_speed();

View File

@ -17,7 +17,7 @@ namespace alai
*/ */
class PlayerFall : public State class PlayerFall : public State
{ {
GODOT_CLASS(PlayerFall, State) GODOT_CLASS(PlayerFall, State)
private: private:
/** /**
@ -78,7 +78,7 @@ namespace alai
*/ */
void _physics_process(float delta); void _physics_process(float delta);
}; };
} } // namespace player
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "player/states/PlayerIdle.h"
#include "player/Player.h" #include "player/Player.h"
#include "player/states/PlayerIdle.h"
void alai::player::PlayerIdle::_register_methods() void alai::player::PlayerIdle::_register_methods()
{ {

View File

@ -17,7 +17,7 @@ namespace alai
*/ */
class PlayerIdle : public State class PlayerIdle : public State
{ {
GODOT_CLASS(PlayerIdle, State) GODOT_CLASS(PlayerIdle, State)
private: private:
/** /**
@ -77,7 +77,7 @@ namespace alai
*/ */
void _physics_process(float delta); void _physics_process(float delta);
}; };
} } // namespace player
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "player/states/PlayerJump.h"
#include "player/Player.h" #include "player/Player.h"
#include "player/states/PlayerJump.h"
#include <AudioStreamPlayer.hpp> #include <AudioStreamPlayer.hpp>
@ -42,16 +41,16 @@ void alai::player::PlayerJump::_state_enter(const godot::String state)
double_jumped = false; double_jumped = false;
} }
auto parent = Object::cast_to<Player>(get_parent()); auto parent = Object::cast_to<Player>(get_parent());
auto velocity = parent->get_velocity(); auto velocity = parent->get_velocity();
velocity.y = -parent->get_jump_force(); velocity.y = -parent->get_jump_force();
parent->set_velocity(velocity); parent->set_velocity(velocity);
} }
void alai::player::PlayerJump::_state_exit() void alai::player::PlayerJump::_state_exit()
{ {
animated_sprite->set_animation("move"); animated_sprite->set_animation("move");
animated_sprite->set_frame(1); animated_sprite->set_frame(1);
} }
void alai::player::PlayerJump::_physics_process(float delta) void alai::player::PlayerJump::_physics_process(float delta)
@ -64,8 +63,8 @@ void alai::player::PlayerJump::_physics_process(float delta)
} }
auto current_speed = parent->get_speed(); auto current_speed = parent->get_speed();
auto velocity = parent->get_velocity(); auto velocity = parent->get_velocity();
velocity.x = 0; velocity.x = 0;
if (_input->is_action_pressed("run")) if (_input->is_action_pressed("run"))
{ {
current_speed *= parent->get_run_speed(); current_speed *= parent->get_run_speed();

View File

@ -17,7 +17,7 @@ namespace alai
*/ */
class PlayerJump : public State class PlayerJump : public State
{ {
GODOT_CLASS(PlayerJump, State) GODOT_CLASS(PlayerJump, State)
private: private:
/** /**
@ -85,7 +85,7 @@ namespace alai
*/ */
void _physics_process(float delta); void _physics_process(float delta);
}; };
} } // namespace player
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "player/states/PlayerMove.h"
#include "player/Player.h" #include "player/Player.h"
#include "player/states/PlayerMove.h"
void alai::player::PlayerMove::_register_methods() void alai::player::PlayerMove::_register_methods()
{ {
@ -40,8 +39,8 @@ void alai::player::PlayerMove::_physics_process(float delta)
auto direction_pressed = false; auto direction_pressed = false;
auto current_speed = parent->get_speed(); auto current_speed = parent->get_speed();
auto velocity = parent->get_velocity(); auto velocity = parent->get_velocity();
velocity.x = 0; velocity.x = 0;
if (_input->is_action_pressed("run")) if (_input->is_action_pressed("run"))
{ {
current_speed *= parent->get_run_speed(); current_speed *= parent->get_run_speed();

View File

@ -3,9 +3,9 @@
#include "state_machine/State.h" #include "state_machine/State.h"
#include <AnimatedSprite.hpp>
#include <Godot.hpp> #include <Godot.hpp>
#include <Input.hpp> #include <Input.hpp>
#include <AnimatedSprite.hpp>
namespace alai namespace alai
{ {
@ -17,7 +17,7 @@ namespace alai
*/ */
class PlayerMove : public State class PlayerMove : public State
{ {
GODOT_CLASS(PlayerMove, State) GODOT_CLASS(PlayerMove, State)
private: private:
/** /**
@ -77,7 +77,7 @@ namespace alai
*/ */
void _physics_process(float delta); void _physics_process(float delta);
}; };
} } // namespace player
} } // namespace alai
#endif #endif

View File

@ -13,7 +13,7 @@ namespace alai
*/ */
class State : public StateMachine class State : public StateMachine
{ {
GODOT_CLASS(State, Node) GODOT_CLASS(State, Node)
private: private:
/** /**
@ -98,6 +98,6 @@ namespace alai
*/ */
virtual StateMachine *get_state_machine() final; virtual StateMachine *get_state_machine() final;
}; };
} } // namespace alai
#endif #endif

View File

@ -1,6 +1,5 @@
#include "state_machine/StateMachine.h"
#include "state_machine/State.h" #include "state_machine/State.h"
#include "state_machine/StateMachine.h"
void alai::StateMachine::_register_methods() void alai::StateMachine::_register_methods()
{ {
@ -54,7 +53,7 @@ void alai::StateMachine::setup()
if (children.size() > 0) if (children.size() > 0)
{ {
WARN_PRINT("The state machine doesn't have a default state set, using first child!"); WARN_PRINT("The state machine doesn't have a default state set, using first child!");
auto child = Object::cast_to<Node>(children[0].operator Object*()); auto child = Object::cast_to<Node>(children[0].operator Object * ());
set_current_state(child->get_name()); set_current_state(child->get_name());
} }
else else
@ -66,7 +65,7 @@ void alai::StateMachine::setup()
for (uint8_t i = 0; i < children.size(); i++) for (uint8_t i = 0; i < children.size(); i++)
{ {
auto child = Object::cast_to<Node>(children[i].operator Object*()); auto child = Object::cast_to<Node>(children[i].operator Object * ());
child->call("set_state_machine", this); child->call("set_state_machine", this);
@ -83,7 +82,8 @@ void alai::StateMachine::setup()
{ {
this->call("_state_enter", get_current_state()); this->call("_state_enter", get_current_state());
} }
else { else
{
WARN_PRINT("The state " + get_current_state() + " doesn't have a _state_enter method!"); WARN_PRINT("The state " + get_current_state() + " doesn't have a _state_enter method!");
} }
} }
@ -93,7 +93,7 @@ void alai::StateMachine::add_states()
auto children = get_children(); auto children = get_children();
for (uint8_t i = 0; i < children.size(); i++) for (uint8_t i = 0; i < children.size(); i++)
{ {
auto child = Object::cast_to<Node>(children[i].operator Object*()); auto child = Object::cast_to<Node>(children[i].operator Object * ());
add_state(child->get_name(), child); add_state(child->get_name(), child);
} }
} }
@ -120,7 +120,7 @@ bool alai::StateMachine::has(const godot::String state)
return states.has(state); return states.has(state);
} }
void alai::StateMachine::restart(const godot::String state, const godot::Array& args) void alai::StateMachine::restart(const godot::String state, const godot::Array &args)
{ {
this->call("_state_exit", state, args); this->call("_state_exit", state, args);
this->call("_state_enter", state, args); this->call("_state_enter", state, args);
@ -162,7 +162,7 @@ void alai::StateMachine::change(const godot::String state, const godot::Array &a
if (get_current_state() != "") if (get_current_state() != "")
{ {
auto child = Object::cast_to<Node>(states[get_current_state()].operator Object*()); auto child = Object::cast_to<Node>(states[get_current_state()].operator Object * ());
if (child != nullptr) if (child != nullptr)
{ {
this->remove_child(child); this->remove_child(child);
@ -175,7 +175,7 @@ void alai::StateMachine::change(const godot::String state, const godot::Array &a
} }
set_current_state(state); set_current_state(state);
auto child = Object::cast_to<Node>(states[get_current_state()].operator Object*()); auto child = Object::cast_to<Node>(states[get_current_state()].operator Object * ());
this->add_child(child); this->add_child(child);
state_node = Object::cast_to<Node>(this->states[get_current_state()]); state_node = Object::cast_to<Node>(this->states[get_current_state()]);
@ -204,7 +204,7 @@ void alai::StateMachine::change(const godot::String state, const godot::Array &a
godot::Variant alai::StateMachine::call(const godot::String method, const godot::Array &args) godot::Variant alai::StateMachine::call(const godot::String method, const godot::Array &args)
{ {
auto node = Object::cast_to<Node>(states[get_current_state()].operator Object*()); auto node = Object::cast_to<Node>(states[get_current_state()].operator Object * ());
if (node) if (node)
{ {
if (node->has_method(method)) if (node->has_method(method))
@ -269,7 +269,7 @@ void alai::StateMachine::_on_StateMachine_tree_exiting()
auto keys = states.keys(); auto keys = states.keys();
for (uint8_t i = 0; i < keys.size(); i++) for (uint8_t i = 0; i < keys.size(); i++)
{ {
auto child = Object::cast_to<Node>(states[keys[i]].operator Object*()); auto child = Object::cast_to<Node>(states[keys[i]].operator Object * ());
if (child) if (child)
{ {
auto children = get_children(); auto children = get_children();

View File

@ -12,7 +12,7 @@ namespace alai
*/ */
class StateMachine : public godot::Node class StateMachine : public godot::Node
{ {
GODOT_CLASS(StateMachine, godot::Node) GODOT_CLASS(StateMachine, godot::Node)
private: private:
/** /**
@ -126,7 +126,7 @@ namespace alai
* @param[in] state The state that is being restarted. * @param[in] state The state that is being restarted.
* @param[in] args The arguments to pass to the state on exit and enter. * @param[in] args The arguments to pass to the state on exit and enter.
*/ */
void restart(const godot::String state, const godot::Array& args = godot::Array()); void restart(const godot::String state, const godot::Array &args = godot::Array());
/** /**
* @brief Change to a different state. * @brief Change to a different state.
@ -214,7 +214,7 @@ namespace alai
* @param[in] state The state being restarted. * @param[in] state The state being restarted.
* @param[in] args The arguments to pass when restarting. * @param[in] args The arguments to pass when restarting.
*/ */
template <class ...Args> void restart(const godot::String state, Args ...args) template<class... Args> void restart(const godot::String state, Args... args)
{ {
return restart(state, godot::Array::make(args...)); return restart(state, godot::Array::make(args...));
} }
@ -226,7 +226,7 @@ namespace alai
* @param[in] state The state to change to. * @param[in] state The state to change to.
* @param[in] args The arguments to pass to the new state. * @param[in] args The arguments to pass to the new state.
*/ */
template <class ...Args> void change(const godot::String state, Args ...args) template<class... Args> void change(const godot::String state, Args... args)
{ {
return change(state, godot::Array::make(args...)); return change(state, godot::Array::make(args...));
} }
@ -239,7 +239,7 @@ namespace alai
* @param[in] args The arguments to pass to it. * @param[in] args The arguments to pass to it.
* @return Variant The Variant object returned by the method called. * @return Variant The Variant object returned by the method called.
*/ */
template <class ...Args> godot::Variant call(const godot::String method, Args ...args) template<class... Args> godot::Variant call(const godot::String method, Args... args)
{ {
return call(method, godot::Array::make(args...)); return call(method, godot::Array::make(args...));
} }
@ -252,11 +252,11 @@ namespace alai
* @param[in] args The arguments to pass. * @param[in] args The arguments to pass.
* @return Variant The Variant object returned by the method called. * @return Variant The Variant object returned by the method called.
*/ */
template <class ...Args> godot::Variant _call(const godot::String method, Args ...args) template<class... Args> godot::Variant _call(const godot::String method, Args... args)
{ {
return _call(method, godot::Array::make(args...)); return _call(method, godot::Array::make(args...));
} }
}; };
} } // namespace alai
#endif #endif