tweaks #4
4
Makefile
4
Makefile
@ -24,10 +24,10 @@ godot-cpp-windows:
|
|||||||
game: game-linux game-windows
|
game: game-linux game-windows
|
||||||
|
|
||||||
game-linux:
|
game-linux:
|
||||||
scons use_llvm=$(USE_LLVM) target=$(RELEASE_TYPE) target_path=godot/gdnative/ target_name=libjuego platform=linux bits=64 -j $(PROCS)
|
scons use_llvm=$(USE_LLVM) target=$(RELEASE_TYPE) target_path=godot/gdnative/ target_name=libalai platform=linux bits=64 -j $(PROCS)
|
||||||
|
|
||||||
game-windows:
|
game-windows:
|
||||||
scons target=$(RELEASE_TYPE) target_name=libjuego target_path=godot/gdnative/ platform=windows bits=64 -j $(PROCS)
|
scons target=$(RELEASE_TYPE) target_name=libalai target_path=godot/gdnative/ platform=windows bits=64 -j $(PROCS)
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
# if doxygen and bear are installed create the code documentation
|
# if doxygen and bear are installed create the code documentation
|
||||||
|
@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
|
|||||||
# title of most generated pages and in a few other places.
|
# title of most generated pages and in a few other places.
|
||||||
# The default value is: My Project.
|
# The default value is: My Project.
|
||||||
|
|
||||||
PROJECT_NAME = "juego"
|
PROJECT_NAME = "Alai"
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://gdnative/libjuego.tres" type="GDNativeLibrary" id=1]
|
[ext_resource path="res://gdnative/libalai.tres" type="GDNativeLibrary" id=1]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "Main"
|
resource_name = "Main"
|
||||||
|
@ -5,6 +5,5 @@
|
|||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
launch_screen = 0
|
|
||||||
|
|
||||||
[node name="Level1" parent="." instance=ExtResource( 2 )]
|
[node name="Level1" parent="." instance=ExtResource( 2 )]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://gdnative/libjuego.tres" type="GDNativeLibrary" id=1]
|
[ext_resource path="res://gdnative/libalai.tres" type="GDNativeLibrary" id=1]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "Player"
|
resource_name = "Player"
|
||||||
|
7
godot/gdnative/libalai.tres
Normal file
7
godot/gdnative/libalai.tres
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="GDNativeLibrary" format=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
entry/Windows.64 = "res://gdnative/windows.64/libalai.dll"
|
||||||
|
entry/X11.64 = "res://gdnative/linux.64/libalai.so"
|
||||||
|
dependency/Windows.64 = [ ]
|
||||||
|
dependency/X11.64 = [ ]
|
@ -1,7 +0,0 @@
|
|||||||
[gd_resource type="GDNativeLibrary" format=2]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
entry/Windows.64 = "res://gdnative/windows.64/libjuego.dll"
|
|
||||||
entry/X11.64 = "res://gdnative/linux.64/libjuego.so"
|
|
||||||
dependency/Windows.64 = [ ]
|
|
||||||
dependency/X11.64 = [ ]
|
|
@ -10,7 +10,8 @@ config_version=4
|
|||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Juego"
|
config/name="Alai"
|
||||||
|
config/description="This game is for testing an Artificial Intelligence."
|
||||||
run/main_scene="res://Main.tscn"
|
run/main_scene="res://Main.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
12
src/Main.cpp
12
src/Main.cpp
@ -8,9 +8,9 @@ void Main::_register_methods()
|
|||||||
{
|
{
|
||||||
register_method("_ready", &Main::_ready);
|
register_method("_ready", &Main::_ready);
|
||||||
register_method("_physics_process", &Main::_physics_process);
|
register_method("_physics_process", &Main::_physics_process);
|
||||||
register_property<Main, bool>("full_screen", &Main::set_full_screen, &Main::get_full_screen, JUEGO_MAIN_FULL_SCREEN);
|
register_property<Main, bool>("full_screen", &Main::set_full_screen, &Main::get_full_screen, ALAI_MAIN_FULL_SCREEN);
|
||||||
register_property<Main, Vector2>("window_size", &Main::set_window_size, &Main::get_window_size, JUEGO_MAIN_WINDOW_SIZE);
|
register_property<Main, Vector2>("window_size", &Main::set_window_size, &Main::get_window_size, ALAI_MAIN_WINDOW_SIZE);
|
||||||
register_property<Main, int8_t>("launch_screen", &Main::set_launch_screen, &Main::get_launch_screen, JUEGO_MAIN_LAUNCH_SCREEN);
|
register_property<Main, int8_t>("launch_screen", &Main::set_launch_screen, &Main::get_launch_screen, ALAI_MAIN_LAUNCH_SCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
Main::Main()
|
Main::Main()
|
||||||
@ -26,9 +26,9 @@ void Main::_init()
|
|||||||
_os = OS::get_singleton();
|
_os = OS::get_singleton();
|
||||||
_input = Input::get_singleton();
|
_input = Input::get_singleton();
|
||||||
|
|
||||||
full_screen = JUEGO_MAIN_FULL_SCREEN;
|
full_screen = ALAI_MAIN_FULL_SCREEN;
|
||||||
window_size = JUEGO_MAIN_WINDOW_SIZE;
|
window_size = ALAI_MAIN_WINDOW_SIZE;
|
||||||
launch_screen = JUEGO_MAIN_LAUNCH_SCREEN;
|
launch_screen = ALAI_MAIN_LAUNCH_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Main::_ready()
|
void Main::_ready()
|
||||||
|
@ -14,10 +14,10 @@ void Player::_register_methods()
|
|||||||
register_method("_physics_process", &Player::_physics_process);
|
register_method("_physics_process", &Player::_physics_process);
|
||||||
register_method("_on_Player_player_moved", &Player::_on_Player_player_moved);
|
register_method("_on_Player_player_moved", &Player::_on_Player_player_moved);
|
||||||
//register_property<Player, Ref<SpriteFrames>>("sprite_frames", &Player::set_sprite_frames, &Player::get_sprite_frames, Ref<SpriteFrames>(), GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_DEFAULT, GODOT_PROPERTY_HINT_RESOURCE_TYPE, String("SpriteFrames"));
|
//register_property<Player, Ref<SpriteFrames>>("sprite_frames", &Player::set_sprite_frames, &Player::get_sprite_frames, Ref<SpriteFrames>(), GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_DEFAULT, GODOT_PROPERTY_HINT_RESOURCE_TYPE, String("SpriteFrames"));
|
||||||
register_property<Player, float>("speed", &Player::set_speed, &Player::get_speed, JUEGO_PLAYER_SPEED);
|
register_property<Player, float>("speed", &Player::set_speed, &Player::get_speed, ALAI_PLAYER_SPEED);
|
||||||
register_property<Player, float>("jump_force", &Player::set_jump_force, &Player::get_jump_force, JUEGO_PLAYER_JUMP_FORCE);
|
register_property<Player, float>("jump_force", &Player::set_jump_force, &Player::get_jump_force, ALAI_PLAYER_JUMP_FORCE);
|
||||||
register_property<Player, float>("gravity", &Player::set_gravity, &Player::get_gravity, JUEGO_PLAYER_GRAVITY);
|
register_property<Player, float>("gravity", &Player::set_gravity, &Player::get_gravity, ALAI_PLAYER_GRAVITY);
|
||||||
register_property<Player, float>("run_speed", &Player::set_run_speed, &Player::get_run_speed, JUEGO_PLAYER_RUN_SPEED);
|
register_property<Player, float>("run_speed", &Player::set_run_speed, &Player::get_run_speed, ALAI_PLAYER_RUN_SPEED);
|
||||||
register_signal<Player>("player_moved", "position", GODOT_VARIANT_TYPE_VECTOR2);
|
register_signal<Player>("player_moved", "position", GODOT_VARIANT_TYPE_VECTOR2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,11 +35,11 @@ void Player::_init()
|
|||||||
_input = Input::get_singleton();
|
_input = Input::get_singleton();
|
||||||
_resource_loader = ResourceLoader::get_singleton();
|
_resource_loader = ResourceLoader::get_singleton();
|
||||||
|
|
||||||
//sprite_frames = _resource_loader->load(JUEGO_PLAYER_SPRITE_FRAMES);
|
//sprite_frames = _resource_loader->load(ALAI_PLAYER_SPRITE_FRAMES);
|
||||||
set_speed(JUEGO_PLAYER_SPEED);
|
set_speed(ALAI_PLAYER_SPEED);
|
||||||
set_jump_force(JUEGO_PLAYER_JUMP_FORCE);
|
set_jump_force(ALAI_PLAYER_JUMP_FORCE);
|
||||||
set_gravity(JUEGO_PLAYER_GRAVITY);
|
set_gravity(ALAI_PLAYER_GRAVITY);
|
||||||
set_run_speed(JUEGO_PLAYER_RUN_SPEED);
|
set_run_speed(ALAI_PLAYER_RUN_SPEED);
|
||||||
|
|
||||||
coins = 0;
|
coins = 0;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef JUEGO_MAIN_H
|
#ifndef ALAI_MAIN_H
|
||||||
#define JUEGO_MAIN_H
|
#define ALAI_MAIN_H
|
||||||
|
|
||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <Node.hpp>
|
#include <Node.hpp>
|
||||||
@ -9,17 +9,17 @@
|
|||||||
/**
|
/**
|
||||||
* @brief If the game should be full screen or not by default.
|
* @brief If the game should be full screen or not by default.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_MAIN_FULL_SCREEN false
|
#define ALAI_MAIN_FULL_SCREEN false
|
||||||
/**
|
/**
|
||||||
* @brief The default size of the window.
|
* @brief The default size of the window.
|
||||||
* @details This is ignored if full screen is true.
|
* @details This is ignored if full screen is true.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_MAIN_WINDOW_SIZE Vector2(1280, 720)
|
#define ALAI_MAIN_WINDOW_SIZE Vector2(1280, 720)
|
||||||
/**
|
/**
|
||||||
* @brief Which screen to launch the game on.
|
* @brief Which screen to launch the game on.
|
||||||
* @details If -1 it will launch the game on the "active" screen. Anything between 0 and N represents the screen number to show the game on when opened.
|
* @details If -1 it will launch the game on the "active" screen. Anything between 0 and N represents the screen number to show the game on when opened.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_MAIN_LAUNCH_SCREEN -1
|
#define ALAI_MAIN_LAUNCH_SCREEN -1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the godot namespace for all the code included in the library.
|
* @brief This is the godot namespace for all the code included in the library.
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
#ifndef JUEGO_PLAYER_H
|
#ifndef ALAI_PLAYER_H
|
||||||
#define JUEGO_PLAYER_H
|
#define ALAI_PLAYER_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This resource is loaded by default for the AnimatedSprite node.
|
* @brief This resource is loaded by default for the AnimatedSprite node.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_PLAYER_SPRITE_FRAMES "res://characters/player/sprites/green.tres"
|
#define ALAI_PLAYER_SPRITE_FRAMES "res://characters/player/sprites/green.tres"
|
||||||
/**
|
/**
|
||||||
* @brief The speed the player should move it.
|
* @brief The speed the player should move it.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_PLAYER_SPEED 60.0
|
#define ALAI_PLAYER_SPEED 60.0
|
||||||
/**
|
/**
|
||||||
* @brief The force applied to the player when jumping.
|
* @brief The force applied to the player when jumping.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_PLAYER_JUMP_FORCE 300.0
|
#define ALAI_PLAYER_JUMP_FORCE 300.0
|
||||||
/**
|
/**
|
||||||
* @brief The gravity applied to the player.
|
* @brief The gravity applied to the player.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_PLAYER_GRAVITY 9.81
|
#define ALAI_PLAYER_GRAVITY 9.81
|
||||||
/**
|
/**
|
||||||
* @brief The multiplier used to change the speed of the player when running.
|
* @brief The multiplier used to change the speed of the player when running.
|
||||||
*/
|
*/
|
||||||
#define JUEGO_PLAYER_RUN_SPEED 2.0
|
#define ALAI_PLAYER_RUN_SPEED 2.0
|
||||||
|
|
||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <KinematicBody2D.hpp>
|
#include <KinematicBody2D.hpp>
|
||||||
|
Loading…
Reference in New Issue
Block a user