Merge pull request 'tweaks' (#4) from tweaks into develop

Reviewed-on: Proyecto-Titulo/juego#4
This commit is contained in:
Chris Cromer 2022-04-09 21:51:22 -04:00
commit b3392035c9
18 changed files with 68 additions and 62 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@
api.json
# Visual Studio Code Project file
source.code-workspace
*.code-workspace
# Visual Studio Cache
.vs/

View File

@ -24,10 +24,10 @@ godot-cpp-windows:
game: game-linux game-windows
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:
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:
# if doxygen and bear are installed create the code documentation

View File

@ -1,5 +1,5 @@
# Juego
# Alai
## License
[3-Clause BSD License](LICENSE)
[3-Clause BSD License](LICENSE)

View File

@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# 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
# could be handy for archiving the generated documentation or if some version

View File

@ -4,10 +4,9 @@
[ext_resource path="res://levels/level01.tmx" type="PackedScene" id=3]
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=4]
[node name="Level 1" type="Node2D"]
[node name="Level1" type="Node2D"]
[node name="Player" parent="." instance=ExtResource( 4 )]
position = Vector2( 8, 5 )
[node name="Camera2D" type="Camera2D" parent="Player"]
current = true

View File

@ -1,6 +1,6 @@
[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_name = "Main"

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Main.gdns" type="Script" id=1]
[ext_resource path="res://Level 1.tscn" type="PackedScene" id=2]
[ext_resource path="res://Level1.tscn" type="PackedScene" id=2]
[node name="Main" type="Node"]
script = ExtResource( 1 )
launch_screen = 0
[node name="Level 1" parent="." instance=ExtResource( 2 )]
[node name="Level1" parent="." instance=ExtResource( 2 )]

View File

@ -1,6 +1,6 @@
[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_name = "Player"

View File

@ -3,9 +3,8 @@
[ext_resource path="res://characters/player/sprites/green.tres" type="SpriteFrames" id=1]
[ext_resource path="res://characters/player/Player.gdns" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 6.0
height = 12.0
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 11.5 )
[node name="Player" type="KinematicBody2D"]
script = ExtResource( 2 )
@ -16,7 +15,7 @@ animation = "idle"
centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 12, 12 )
position = Vector2( 12, 12.5 )
shape = SubResource( 1 )
[connection signal="player_moved" from="." to="." method="_on_Player_player_moved"]

View File

@ -1,7 +0,0 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View 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 = [ ]

View File

@ -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 = [ ]

View File

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@ -31,5 +31,5 @@ process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
detect_3d=false
svg/scale=1.0

View File

@ -10,7 +10,8 @@ config_version=4
[application]
config/name="Juego"
config/name="Alai"
config/description="This game is for testing an Artificial Intelligence."
run/main_scene="res://Main.tscn"
config/icon="res://icon.png"
@ -21,6 +22,10 @@ window/size/height=288
window/stretch/mode="viewport"
window/stretch/aspect="keep"
[editor]
scene/scene_naming=1
[editor_plugins]
enabled=PoolStringArray( "res://addons/vnen.tiled_importer/plugin.cfg" )
@ -74,14 +79,25 @@ right={
]
}
[layer_names]
2d_physics/layer_1="Tiles"
2d_physics/layer_2="Player"
[physics]
common/enable_pause_aware_picking=true
2d/cell_size=18
[rendering]
environment/default_environment="res://default_env.tres"
2d/snapping/use_gpu_pixel_snap=true
misc/lossless_compression/force_png=true
[tiled_importer]
enable_json_format=false
[world]
2d/cell_size=18

View File

@ -8,9 +8,9 @@ void Main::_register_methods()
{
register_method("_ready", &Main::_ready);
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, Vector2>("window_size", &Main::set_window_size, &Main::get_window_size, JUEGO_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, 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, ALAI_MAIN_WINDOW_SIZE);
register_property<Main, int8_t>("launch_screen", &Main::set_launch_screen, &Main::get_launch_screen, ALAI_MAIN_LAUNCH_SCREEN);
}
Main::Main()
@ -26,9 +26,9 @@ void Main::_init()
_os = OS::get_singleton();
_input = Input::get_singleton();
full_screen = JUEGO_MAIN_FULL_SCREEN;
window_size = JUEGO_MAIN_WINDOW_SIZE;
launch_screen = JUEGO_MAIN_LAUNCH_SCREEN;
full_screen = ALAI_MAIN_FULL_SCREEN;
window_size = ALAI_MAIN_WINDOW_SIZE;
launch_screen = ALAI_MAIN_LAUNCH_SCREEN;
}
void Main::_ready()

View File

@ -14,10 +14,10 @@ void Player::_register_methods()
register_method("_physics_process", &Player::_physics_process);
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, float>("speed", &Player::set_speed, &Player::get_speed, JUEGO_PLAYER_SPEED);
register_property<Player, float>("jump_force", &Player::set_jump_force, &Player::get_jump_force, JUEGO_PLAYER_JUMP_FORCE);
register_property<Player, float>("gravity", &Player::set_gravity, &Player::get_gravity, JUEGO_PLAYER_GRAVITY);
register_property<Player, float>("run_speed", &Player::set_run_speed, &Player::get_run_speed, JUEGO_PLAYER_RUN_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, ALAI_PLAYER_JUMP_FORCE);
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, ALAI_PLAYER_RUN_SPEED);
register_signal<Player>("player_moved", "position", GODOT_VARIANT_TYPE_VECTOR2);
}
@ -35,11 +35,11 @@ void Player::_init()
_input = Input::get_singleton();
_resource_loader = ResourceLoader::get_singleton();
//sprite_frames = _resource_loader->load(JUEGO_PLAYER_SPRITE_FRAMES);
set_speed(JUEGO_PLAYER_SPEED);
set_jump_force(JUEGO_PLAYER_JUMP_FORCE);
set_gravity(JUEGO_PLAYER_GRAVITY);
set_run_speed(JUEGO_PLAYER_RUN_SPEED);
//sprite_frames = _resource_loader->load(ALAI_PLAYER_SPRITE_FRAMES);
set_speed(ALAI_PLAYER_SPEED);
set_jump_force(ALAI_PLAYER_JUMP_FORCE);
set_gravity(ALAI_PLAYER_GRAVITY);
set_run_speed(ALAI_PLAYER_RUN_SPEED);
coins = 0;

View File

@ -1,5 +1,5 @@
#ifndef JUEGO_MAIN_H
#define JUEGO_MAIN_H
#ifndef ALAI_MAIN_H
#define ALAI_MAIN_H
#include <Godot.hpp>
#include <Node.hpp>
@ -9,17 +9,17 @@
/**
* @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.
* @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.
* @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.

View File

@ -1,26 +1,26 @@
#ifndef JUEGO_PLAYER_H
#define JUEGO_PLAYER_H
#ifndef ALAI_PLAYER_H
#define ALAI_PLAYER_H
/**
* @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.
*/
#define JUEGO_PLAYER_SPEED 100.0
#define ALAI_PLAYER_SPEED 60.0
/**
* @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.
*/
#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.
*/
#define JUEGO_PLAYER_RUN_SPEED 2.0
#define ALAI_PLAYER_RUN_SPEED 2.0
#include <Godot.hpp>
#include <KinematicBody2D.hpp>