diff --git a/.gitignore b/.gitignore index 6297a84..b2b3eca 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ api.json # Visual Studio Code Project file -source.code-workspace +*.code-workspace # Visual Studio Cache .vs/ diff --git a/Makefile b/Makefile index d3c418b..e651b4f 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index d87c67f..d7339e6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Juego +# Alai ## License -[3-Clause BSD License](LICENSE) \ No newline at end of file +[3-Clause BSD License](LICENSE) diff --git a/doxygen.conf b/doxygen.conf index bb27cef..244e1f1 100644 --- a/doxygen.conf +++ b/doxygen.conf @@ -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 diff --git a/godot/Level 1.tscn b/godot/Level1.tscn similarity index 95% rename from godot/Level 1.tscn rename to godot/Level1.tscn index aaa0575..4c3cddc 100644 --- a/godot/Level 1.tscn +++ b/godot/Level1.tscn @@ -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 diff --git a/godot/Main.gdns b/godot/Main.gdns index 1a43cfc..764a788 100644 --- a/godot/Main.gdns +++ b/godot/Main.gdns @@ -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" diff --git a/godot/Main.tscn b/godot/Main.tscn index 83963c6..d264a5c 100644 --- a/godot/Main.tscn +++ b/godot/Main.tscn @@ -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 )] diff --git a/godot/characters/player/Player.gdns b/godot/characters/player/Player.gdns index 047be51..40af8ae 100644 --- a/godot/characters/player/Player.gdns +++ b/godot/characters/player/Player.gdns @@ -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" diff --git a/godot/characters/player/Player.tscn b/godot/characters/player/Player.tscn index 896dbe3..dde73e1 100644 --- a/godot/characters/player/Player.tscn +++ b/godot/characters/player/Player.tscn @@ -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"] diff --git a/godot/default_env.tres b/godot/default_env.tres deleted file mode 100644 index 20207a4..0000000 --- a/godot/default_env.tres +++ /dev/null @@ -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 ) diff --git a/godot/gdnative/libalai.tres b/godot/gdnative/libalai.tres new file mode 100644 index 0000000..e54b81b --- /dev/null +++ b/godot/gdnative/libalai.tres @@ -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 = [ ] diff --git a/godot/gdnative/libjuego.tres b/godot/gdnative/libjuego.tres deleted file mode 100644 index 3cc3c56..0000000 --- a/godot/gdnative/libjuego.tres +++ /dev/null @@ -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 = [ ] diff --git a/godot/icon.png.import b/godot/icon.png.import index a4c02e6..eb3cdb6 100644 --- a/godot/icon.png.import +++ b/godot/icon.png.import @@ -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 diff --git a/godot/project.godot b/godot/project.godot index a7f684a..e1b9eb4 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -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 diff --git a/src/Main.cpp b/src/Main.cpp index 6202fcf..315bf3b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -8,9 +8,9 @@ void Main::_register_methods() { register_method("_ready", &Main::_ready); register_method("_physics_process", &Main::_physics_process); - register_property("full_screen", &Main::set_full_screen, &Main::get_full_screen, JUEGO_MAIN_FULL_SCREEN); - register_property("window_size", &Main::set_window_size, &Main::get_window_size, JUEGO_MAIN_WINDOW_SIZE); - register_property("launch_screen", &Main::set_launch_screen, &Main::get_launch_screen, JUEGO_MAIN_LAUNCH_SCREEN); + register_property("full_screen", &Main::set_full_screen, &Main::get_full_screen, ALAI_MAIN_FULL_SCREEN); + register_property("window_size", &Main::set_window_size, &Main::get_window_size, ALAI_MAIN_WINDOW_SIZE); + register_property("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() diff --git a/src/Player.cpp b/src/Player.cpp index efb7fda..0b0e0fe 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -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>("sprite_frames", &Player::set_sprite_frames, &Player::get_sprite_frames, Ref(), GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_DEFAULT, GODOT_PROPERTY_HINT_RESOURCE_TYPE, String("SpriteFrames")); - register_property("speed", &Player::set_speed, &Player::get_speed, JUEGO_PLAYER_SPEED); - register_property("jump_force", &Player::set_jump_force, &Player::get_jump_force, JUEGO_PLAYER_JUMP_FORCE); - register_property("gravity", &Player::set_gravity, &Player::get_gravity, JUEGO_PLAYER_GRAVITY); - register_property("run_speed", &Player::set_run_speed, &Player::get_run_speed, JUEGO_PLAYER_RUN_SPEED); + register_property("speed", &Player::set_speed, &Player::get_speed, ALAI_PLAYER_SPEED); + register_property("jump_force", &Player::set_jump_force, &Player::get_jump_force, ALAI_PLAYER_JUMP_FORCE); + register_property("gravity", &Player::set_gravity, &Player::get_gravity, ALAI_PLAYER_GRAVITY); + register_property("run_speed", &Player::set_run_speed, &Player::get_run_speed, ALAI_PLAYER_RUN_SPEED); register_signal("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; diff --git a/src/include/Main.h b/src/include/Main.h index 98c5611..71c9253 100644 --- a/src/include/Main.h +++ b/src/include/Main.h @@ -1,5 +1,5 @@ -#ifndef JUEGO_MAIN_H -#define JUEGO_MAIN_H +#ifndef ALAI_MAIN_H +#define ALAI_MAIN_H #include #include @@ -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. diff --git a/src/include/Player.h b/src/include/Player.h index ab30e97..aca9b16 100644 --- a/src/include/Player.h +++ b/src/include/Player.h @@ -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 #include