diff --git a/.gitmodules b/.gitmodules index d8a7489..0d55813 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "cpp/pong/godot-cpp"] path = cpp/pong/godot-cpp url = https://github.com/godotengine/godot-cpp.git +[submodule "cpp/dodge_the_creeps/godot-cpp"] + path = cpp/dodge_the_creeps/godot-cpp + url = https://github.com/godotengine/godot-cpp.git diff --git a/cpp/dodge_the_creeps/README.md b/cpp/dodge_the_creeps/README.md new file mode 100644 index 0000000..41dfd6f --- /dev/null +++ b/cpp/dodge_the_creeps/README.md @@ -0,0 +1,47 @@ +# Dodge the Creeps with GDNative C++ + +This is a simple game where your character must move +and avoid the enemies for as long as possible, made in GDNative C++. + +This is a finished version of the game featured in the +["Your first game"](https://docs.godotengine.org/en/latest/getting_started/step_by_step/your_first_game.html) +tutorial in the documentation. For more details, +consider following the tutorial in the documentation. + +Language: GDScript + +Renderer: GLES 3 (particles are not available in GLES 2) + +Note: There is a GDScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/2d/dodge_the_creeps). + +Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps). + +## Compiling + +You can use SCons to compile the library: + +``` +scons platform=PLATFORM +``` + +Where PLATFORM is: `windows`, `linux`, or `osx`. + +This creates the file `libsimple` in the respective +subfolders in the `project/gdnative` directory. + +Dependencies: + * You need [godot-cpp](https://github.com/godotengine/godot-cpp), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C compiler that's C++14 compatible. + +## Screenshots + +![GIF from the documentation](https://docs.godotengine.org/en/latest/_images/dodge_preview.gif) + +## Copying + +`art/House In a Forest Loop.ogg` Copyright © 2012 [HorrorPen](https://opengameart.org/users/horrorpen), [CC-BY 3.0: Attribution](http://creativecommons.org/licenses/by/3.0/). Source: https://opengameart.org/content/loop-house-in-a-forest + +Images are from "Abstract Platformer". Created in 2016 by kenney.nl, [CC0 1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/). Source: https://www.kenney.nl/assets/abstract-platformer + +Font is "Xolonium". Copyright © 2011-2016 Severin Meyer , with Reserved Font Name Xolonium, SIL open font license version 1.1. Details are in `fonts/LICENSE.txt`. diff --git a/cpp/dodge_the_creeps/SConstruct b/cpp/dodge_the_creeps/SConstruct new file mode 100644 index 0000000..51432e0 --- /dev/null +++ b/cpp/dodge_the_creeps/SConstruct @@ -0,0 +1,111 @@ +#!python +import os + +opts = Variables([], ARGUMENTS) + +# Gets the standard flags CC, CCX, etc. +env = DefaultEnvironment() + +godot_headers_path = "godot-cpp/godot-headers" +godot_bindings_path = "godot-cpp" + +# Define our options. Use future-proofed names for platforms. +platform_array = ["", "windows", "linuxbsd", "macos", "x11", "linux", "osx"] +opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"])) +opts.Add(EnumVariable("platform", "Compilation platform", "", platform_array)) +opts.Add(EnumVariable("p", "Alias for 'platform'", "", platform_array)) +opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no")) +opts.Add(PathVariable("target_path", "The path where the lib is installed.", "project/gdnative/")) +opts.Add(PathVariable("target_name", "The library name.", "libdodgethecreeps", PathVariable.PathAccept)) + +# Updates the environment with the option variables. +opts.Update(env) + +# Process platform arguments. Here we use the same names as GDNative. +if env["p"] != "": + env["platform"] = env["p"] + +if env["platform"] == "macos": + env["platform"] = "osx" +elif env["platform"] in ("x11", "linuxbsd"): + env["platform"] = "linux" +elif env["platform"] == "bsd": + env["platform"] = "freebsd" + +if env["platform"] == "": + print("No valid target platform selected.") + quit() + +platform = env["platform"] + +# Process other arguments. +if env["platform"] == "osx" and not env["use_llvm"]: + env["use_llvm"] = "yes" + +if env["use_llvm"] == "yes": + env["CC"] = "clang" + env["CXX"] = "clang++" + +# put stuff that is the same for all first, saves duplication +if env["platform"] == "osx": + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-g", "-O2", "-arch", "x86_64", "-std=c++14"]) + env.Append(LINKFLAGS=["-arch", "x86_64"]) + else: + env.Append(CCFLAGS=["-g", "-O3", "-arch", "x86_64", "-std=c++14"]) + env.Append(LINKFLAGS=["-arch", "x86_64"]) +elif env["platform"] == "linux": + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-fPIC", "-g3", "-Og"]) + else: + env.Append(CCFLAGS=["-fPIC", "-g", "-O3"]) +elif env["platform"] == "windows": + # This makes sure to keep the session environment variables + # on Windows, so that you can run scons in a VS 2017 prompt + # and it will find all the required tools. + env = Environment(ENV=os.environ) + opts.Update(env) + + env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS"]) + if env["target"] in ("debug", "d"): + env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "-MDd"]) + else: + env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "-MD"]) + +SConscript("godot-cpp/SConstruct") + + +def add_sources(sources, dir): + for f in os.listdir(dir): + if f.endswith(".cpp"): + sources.append(dir + "/" + f) + + +env.Append( + CPPPATH=[ + godot_headers_path, + godot_bindings_path + "/include", + godot_bindings_path + "/include/gen/", + godot_bindings_path + "/include/core/", + ] +) + +env.Append( + LIBS=[ + env.File( + os.path.join( + "godot-cpp/bin", "libgodot-cpp.%s.%s.64%s" % (env["platform"], env["target"], env["LIBSUFFIX"]) + ) + ) + ] +) + +env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) + +sources = [] +add_sources(sources, "src") + +library = env.SharedLibrary( + target=env["target_path"] + "/" + env["platform"] + "/" + env["target_name"], source=sources +) +Default(library) diff --git a/cpp/dodge_the_creeps/project/HUD.tscn b/cpp/dodge_the_creeps/project/HUD.tscn new file mode 100644 index 0000000..42bb0e0 --- /dev/null +++ b/cpp/dodge_the_creeps/project/HUD.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://gdnative/hud.gdns" type="Script" id=1] +[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 64 +font_data = ExtResource( 2 ) + +[sub_resource type="DynamicFont" id=2] +size = 64 +font_data = ExtResource( 2 ) + +[sub_resource type="InputEventAction" id=3] +action = "ui_select" + +[sub_resource type="ShortCut" id=4] +shortcut = SubResource( 3 ) + +[node name="HUD" type="CanvasLayer"] +script = ExtResource( 1 ) + +[node name="ScoreLabel" type="Label" parent="."] +anchor_right = 1.0 +margin_bottom = 78.0 +custom_fonts/font = SubResource( 1 ) +text = "0" +align = 1 + +[node name="MessageLabel" type="Label" parent="."] +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_top = -79.5 +margin_bottom = 79.5 +custom_fonts/font = SubResource( 1 ) +text = "Dodge the +Creeps" +align = 1 + +[node name="StartButton" type="Button" parent="."] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -90.0 +margin_top = -200.0 +margin_right = 90.0 +margin_bottom = -100.0 +custom_fonts/font = SubResource( 2 ) +shortcut = SubResource( 4 ) +text = "Start" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="StartButtonTimer" type="Timer" parent="."] + +[node name="StartMessageTimer" type="Timer" parent="."] +one_shot = true + +[node name="GetReadyMessageTimer" type="Timer" parent="."] +one_shot = true + +[connection signal="pressed" from="StartButton" to="." method="_on_StartButton_pressed"] +[connection signal="timeout" from="StartButtonTimer" to="StartButton" method="show"] +[connection signal="timeout" from="StartMessageTimer" to="." method="_on_StartMessageTimer_timeout"] +[connection signal="timeout" from="GetReadyMessageTimer" to="." method="_on_GetReadyMessageTimer_timeout"] diff --git a/cpp/dodge_the_creeps/project/Main.tscn b/cpp/dodge_the_creeps/project/Main.tscn new file mode 100644 index 0000000..2423746 --- /dev/null +++ b/cpp/dodge_the_creeps/project/Main.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://gdnative/main.gdns" type="Script" id=1] +[ext_resource path="res://Mob.tscn" type="PackedScene" id=2] +[ext_resource path="res://Player.tscn" type="PackedScene" id=3] +[ext_resource path="res://HUD.tscn" type="PackedScene" id=4] +[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=5] +[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6] + +[sub_resource type="Curve2D" id=1] +_data = { +"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0 ) +} + +[node name="Main" type="Node"] +script = ExtResource( 1 ) +mob_scene = ExtResource( 2 ) + +[node name="ColorRect" type="ColorRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.219608, 0.372549, 0.380392, 1 ) + +[node name="Player" parent="." instance=ExtResource( 3 )] + +[node name="MobTimer" type="Timer" parent="."] +wait_time = 0.5 + +[node name="ScoreTimer" type="Timer" parent="."] + +[node name="StartTimer" type="Timer" parent="."] +wait_time = 2.0 +one_shot = true + +[node name="StartPosition" type="Position2D" parent="."] +position = Vector2( 240, 450 ) + +[node name="MobPath" type="Path2D" parent="."] +curve = SubResource( 1 ) + +[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"] + +[node name="HUD" parent="." instance=ExtResource( 4 )] + +[node name="Music" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 5 ) + +[node name="DeathSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) + +[connection signal="hit" from="Player" to="." method="game_over"] +[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"] +[connection signal="timeout" from="ScoreTimer" to="." method="_on_ScoreTimer_timeout"] +[connection signal="timeout" from="StartTimer" to="." method="_on_StartTimer_timeout"] +[connection signal="start_game" from="HUD" to="." method="new_game"] diff --git a/cpp/dodge_the_creeps/project/Mob.tscn b/cpp/dodge_the_creeps/project/Mob.tscn new file mode 100644 index 0000000..e5effc2 --- /dev/null +++ b/cpp/dodge_the_creeps/project/Mob.tscn @@ -0,0 +1,54 @@ +[gd_scene load_steps=10 format=2] + +[ext_resource path="res://gdnative/mob.gdns" type="Script" id=1] +[ext_resource path="res://art/enemyFlyingAlt_1.png" type="Texture" id=2] +[ext_resource path="res://art/enemyFlyingAlt_2.png" type="Texture" id=3] +[ext_resource path="res://art/enemyWalking_1.png" type="Texture" id=4] +[ext_resource path="res://art/enemyWalking_2.png" type="Texture" id=5] +[ext_resource path="res://art/enemySwimming_1.png" type="Texture" id=6] +[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=7] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 2 ), ExtResource( 3 ) ], +"loop": true, +"name": "fly", +"speed": 3.0 +}, { +"frames": [ ExtResource( 4 ), ExtResource( 5 ) ], +"loop": true, +"name": "walk", +"speed": 4.0 +}, { +"frames": [ ExtResource( 6 ), ExtResource( 7 ) ], +"loop": true, +"name": "swim", +"speed": 4.0 +} ] + +[sub_resource type="CapsuleShape2D" id=2] +radius = 35.2706 +height = 23.3281 + +[node name="Mob" type="RigidBody2D" groups=[ +"mobs", +]] +collision_mask = 0 +gravity_scale = 0.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_group_": true +} + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.75, 0.75 ) +frames = SubResource( 1 ) +animation = "walk" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 2 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] + +[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/cpp/dodge_the_creeps/project/Player.tscn b/cpp/dodge_the_creeps/project/Player.tscn new file mode 100644 index 0000000..2615857 --- /dev/null +++ b/cpp/dodge_the_creeps/project/Player.tscn @@ -0,0 +1,71 @@ +[gd_scene load_steps=13 format=2] + +[ext_resource path="res://gdnative/player.gdns" type="Script" id=1] +[ext_resource path="res://art/playerGrey_walk1.png" type="Texture" id=2] +[ext_resource path="res://art/playerGrey_walk2.png" type="Texture" id=3] +[ext_resource path="res://art/playerGrey_up1.png" type="Texture" id=4] +[ext_resource path="res://art/playerGrey_up2.png" type="Texture" id=5] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 2 ), ExtResource( 3 ) ], +"loop": true, +"name": "right", +"speed": 5.0 +}, { +"frames": [ ExtResource( 4 ), ExtResource( 5 ) ], +"loop": true, +"name": "up", +"speed": 5.0 +} ] + +[sub_resource type="CapsuleShape2D" id=2] +radius = 26.1701 +height = 14.822 + +[sub_resource type="Gradient" id=3] +colors = PoolColorArray( 1, 1, 1, 0.501961, 1, 1, 1, 0 ) + +[sub_resource type="GradientTexture" id=4] +gradient = SubResource( 3 ) + +[sub_resource type="Curve" id=5] +_data = [ Vector2( 0.00501098, 0.5 ), 0.0, 0.0, 0, 0, Vector2( 0.994989, 0.324 ), 0.0, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=6] +curve = SubResource( 5 ) + +[sub_resource type="ParticlesMaterial" id=7] +flag_disable_z = true +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 1.0 +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +scale = 0.75 +scale_curve = SubResource( 6 ) +color_ramp = SubResource( 4 ) + +[node name="Player" type="Area2D"] +z_index = 10 +script = ExtResource( 1 ) +__meta__ = { +"_edit_group_": true +} + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.5, 0.5 ) +frames = SubResource( 1 ) +animation = "right" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="Trail" type="Particles2D" parent="."] +z_index = -1 +amount = 10 +speed_scale = 2.0 +local_coords = false +process_material = SubResource( 7 ) +texture = ExtResource( 2 ) + +[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"] diff --git a/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg b/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg new file mode 100644 index 0000000..ece3640 Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg differ diff --git a/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg.import b/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg.import new file mode 100644 index 0000000..3594fd6 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/House In a Forest Loop.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr" + +[deps] + +source_file="res://art/House In a Forest Loop.ogg" +dest_files=[ "res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png new file mode 100644 index 0000000..61c94cd Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png.import b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png.import new file mode 100644 index 0000000..3a8fcfc --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemyFlyingAlt_1.png" +dest_files=[ "res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png new file mode 100644 index 0000000..ea966a9 Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png.import b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png.import new file mode 100644 index 0000000..59a94b6 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemyFlyingAlt_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemyFlyingAlt_2.png" +dest_files=[ "res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/enemySwimming_1.png b/cpp/dodge_the_creeps/project/art/enemySwimming_1.png new file mode 100644 index 0000000..6e4243a Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemySwimming_1.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemySwimming_1.png.import b/cpp/dodge_the_creeps/project/art/enemySwimming_1.png.import new file mode 100644 index 0000000..d5ca8cf --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemySwimming_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemySwimming_1.png" +dest_files=[ "res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/enemySwimming_2.png b/cpp/dodge_the_creeps/project/art/enemySwimming_2.png new file mode 100644 index 0000000..35e7fee Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemySwimming_2.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemySwimming_2.png.import b/cpp/dodge_the_creeps/project/art/enemySwimming_2.png.import new file mode 100644 index 0000000..12f2919 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemySwimming_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemySwimming_2.png" +dest_files=[ "res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/enemyWalking_1.png b/cpp/dodge_the_creeps/project/art/enemyWalking_1.png new file mode 100644 index 0000000..f30770b Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemyWalking_1.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemyWalking_1.png.import b/cpp/dodge_the_creeps/project/art/enemyWalking_1.png.import new file mode 100644 index 0000000..830a9a4 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemyWalking_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemyWalking_1.png" +dest_files=[ "res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/enemyWalking_2.png b/cpp/dodge_the_creeps/project/art/enemyWalking_2.png new file mode 100644 index 0000000..a9cdcaa Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/enemyWalking_2.png differ diff --git a/cpp/dodge_the_creeps/project/art/enemyWalking_2.png.import b/cpp/dodge_the_creeps/project/art/enemyWalking_2.png.import new file mode 100644 index 0000000..b54aac7 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/enemyWalking_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/enemyWalking_2.png" +dest_files=[ "res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/gameover.wav b/cpp/dodge_the_creeps/project/art/gameover.wav new file mode 100644 index 0000000..77f865a Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/gameover.wav differ diff --git a/cpp/dodge_the_creeps/project/art/gameover.wav.import b/cpp/dodge_the_creeps/project/art/gameover.wav.import new file mode 100644 index 0000000..58c33dd --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/gameover.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample" + +[deps] + +source_file="res://art/gameover.wav" +dest_files=[ "res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=true +edit/loop=false +compress/mode=0 diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_up1.png b/cpp/dodge_the_creeps/project/art/playerGrey_up1.png new file mode 100644 index 0000000..98431f8 Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/playerGrey_up1.png differ diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_up1.png.import b/cpp/dodge_the_creeps/project/art/playerGrey_up1.png.import new file mode 100644 index 0000000..7b70f8d --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/playerGrey_up1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/playerGrey_up1.png" +dest_files=[ "res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_up2.png b/cpp/dodge_the_creeps/project/art/playerGrey_up2.png new file mode 100644 index 0000000..4f6c54f Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/playerGrey_up2.png differ diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_up2.png.import b/cpp/dodge_the_creeps/project/art/playerGrey_up2.png.import new file mode 100644 index 0000000..c6f1b92 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/playerGrey_up2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/playerGrey_up2.png" +dest_files=[ "res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png b/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png new file mode 100644 index 0000000..0426b5e Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png differ diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png.import b/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png.import new file mode 100644 index 0000000..326ded6 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/playerGrey_walk1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/playerGrey_walk1.png" +dest_files=[ "res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png b/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png new file mode 100644 index 0000000..975c47e Binary files /dev/null and b/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png differ diff --git a/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png.import b/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png.import new file mode 100644 index 0000000..8d93ac3 --- /dev/null +++ b/cpp/dodge_the_creeps/project/art/playerGrey_walk2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/playerGrey_walk2.png" +dest_files=[ "res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/fonts/FONTLOG.txt b/cpp/dodge_the_creeps/project/fonts/FONTLOG.txt new file mode 100644 index 0000000..826c7d8 --- /dev/null +++ b/cpp/dodge_the_creeps/project/fonts/FONTLOG.txt @@ -0,0 +1,253 @@ +Please distribute this file along with the Xolonium fonts when possible. + + +Source + + Find the sourcefiles of Xolonium at + + + +Credits + + Xolonium is created with FontForge , + Inkscape , Python , and + FontTools . + + It originated as a custom font for the open-source + game Xonotic . With many thanks to the + Xonotic community for your support. + + +Supported OpenType features + + case Provides case sensitive placement of punctuation, + brackets, and math symbols for uppercase text. + frac Replaces number/number sequences with diagonal fractions. + Numbers that touch a slash should not exceed 10 digits. + kern Provides kerning for Latin, Greek, and Cyrillic scripts. + locl Dutch: Replaces j with a stressed version if it follows í. + Sami: Replaces n-form Eng with the preferred N-form version. + Romanian and Moldovan: Replaces ŞşŢţ with the preferred ȘșȚț. + pnum Replaces monospaced digits with proportional versions. + sinf Replaces digits with scientific inferiors below the baseline. + subs Replaces digits with subscript versions on the baseline. + sups Replaces digits with superscript versions. + zero Replaces zero with a slashed version. + + +Supported glyph sets + + Adobe Latin 3 + OpenType W1G + ISO 8859-1 Western European + ISO 8859-2 Central European + ISO 8859-3 South European + ISO 8859-4 North European + ISO 8859-5 Cyrillic + ISO 8859-7 Greek + ISO 8859-9 Turkish + ISO 8859-10 Nordic + ISO 8859-13 Baltic Rim + ISO 8859-14 Celtic + ISO 8859-15 Western European + ISO 8859-16 South-Eastern European + + +Available glyphs + + !"#$%&'()*+,-./0123456789:;<=>? + @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ + `abcdefghijklmnopqrstuvwxyz{|}~ + +  ¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º»¼½¾¿ + ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß + àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ + ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğ + ĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľ + ĿŀŁłŃńŅņŇňŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞş + ŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž + ƒǺǻǼǽǾǿȘșȚțȷ + + ˆˇˉ˘˙˚˛˜˝ + + ͺ;΄΅Ά·ΈΉΊΌΎΏΐ + ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰ + αβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ + + ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОП + РСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп + рстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџ + ѢѣѲѳѴѵҐґҒғҔҕҖҗҘҙҚқҜҝҞҟҠҡҢңҤҥҦҧҨҩ + ҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽӀӁӂӇӈӋӌӏӐӑӒӓ + ӔӕӖӗӘәӜӝӞӟӠӡӢӣӤӥӦӧӨөӮӯӰӱӲӳӴӵӶӷӸӹ + Ԥԥ + + ḂḃḊḋḞḟṀṁṖṗṠṡṪṫẀẁẂẃẄẅẞỲỳ + +      ‒–—―‘’‚‛“”„‟†‡•…‰′″‹›‽‾⁄ + ⁰⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ + ₤₦₩₫€₯₱₹₺₽₿ + ℅ℓ№℗™Ω℮ + ⅛⅜⅝⅞ + ←↑→↓ + ∂∆∏∑−∕∙√∞∟∫≈≠≤≥ + ⌖ + ■▬▮▰▲▶▼◀◆◊●◢◣◤◥ + ☄★☠☢☣⚙⚛⚠⚡⛔ + ❇❈❌❤❰❱❲❳ + fffiflffiffl + 🌌🌍🌎🌏👽💣🔥🔫 + 😁😃😄😆😇😈😉😊😎😐😒😕😘 + 😛😝😞😟😠😣😭😮😲😴😵 + 🚀 + + +Debugging glyphs + +  U+EFFD Font version +  U+F000 Font hinting indicator + + +Changelog + + Xolonium 4.1 2016-11-22 Severin Meyer + Reverted frac OpenType feature to a more stable implementation + + Xolonium 4.0 2016-10-08 Severin Meyer + Decreased width of most glyphs + Thinner vertical stems in Xolonium-Regular + Thicker horizontal stems in Xolonium-Bold + Revised diagonal stems + Lowered middle bars + Revised diacritical bars + Added glyphs: + ӏẞ₿ + U+2007 U+2008 U+2009 U+200A U+202F + U+EFFD U+F000 + Revised glyphs: + $&,JKQRXkwxy~¢¤ßǻ˜ζκλμξφЖУжћѴѵ∕₱₺₦₩€ℓ№≈ffffiffl + ❤🌍🌎🌏😁😄😇😈😉😊😘😭😮😴🚀 + Removed uncommon glyphs: + ʼnſʼҌҍҎҏҾҿӃӄӇӈӚӛӪӫӬӭ + U+0312 U+0313 U+0326 + Simplified OpenType features pnum, zero, and case + Removed OpenType feature dlig + Revised vertical metrics + Merged outlines of composite glyphs in otf version + Added ttf version with custom outlines and instructions + Added woff and woff2 version + + Xolonium 3.1 2015-06-10 Severin Meyer + Added currency glyphs: + ₦₩₫₱₹₺₽ + Revised glyph: + ₯ + Relicensed public release under the SIL Open Font License 1.1 + + Xolonium 3.0 2015-05-04 Severin Meyer + Decreased width of glyphs + Decreased descender height + Increased height of super/subscript glyphs + Revised width of dashes, underscore, and overscore + Sharper bends with more circular proportions + Decreased stroke thickness of mathematical glyphs + Revised diacritical marks + Revised diacritical bars + Revised Cyrillic hooks + Revised glyphs: + GQRYjmuwßŊŒſƒǻfffiffiffl + ΞΨΩδζιξπςστυφω + ЉЄДЛУЭЯбдлэяєљђєћѢѣҨҩҼҽӃӄӘә + #$&'()*,/69?@[]{}~¡£¤¥§©®¿ + ‹›₤€₯ℓ№℗℮←↑→↓∂∏∑∞≈▰☄❈❰❱❲❳😝 + Raised vertical position of mathematical glyphs + Unified advance width of numeral and monetary glyphs + Unified advance width of mathematical glyphs + Revised bearings + Rewrote kern feature + Bolder Xolonium-Bold with improved proportions + Updated glyph names to conform to the AGLFN 1.7 + Revised hints and PS Private Dictionary + Added glyphs: + ӶӷԤԥ + Added OpenType features: + case frac liga locl pnum sinf subs sups zero + + Xolonium 2.4 2014-12-23 Severin Meyer + Added dingbats: + ⛔💣🔥 + Revised size and design of emoticons + Revised dingbats: + ⌖☄☠☣⚙⚛⚠⚡❇❈🌌🌍🌎🌏🔫 + Removed dingbat: + 💥 + + Xolonium 2.3 2014-08-14 Severin Meyer + Bugfixed ε and έ, thanks to bowzee for the feedback + + Xolonium 2.2 2014-03-01 Severin Meyer + Added dingbats: + ⌖◆●❌💥 + Revised dingbats: + •←↑→↓◊☄★☠☣⚙⚛⚠⚡❇❈❤🌌🌍🌎🌏👽🔫🚀 + Removed dingbats: + ♻✪💡📡🔋🔧🔭 + + Xolonium 2.1 2013-10-20 Severin Meyer + Added dingbats: + ←↑→↓❰❱❲❳■▬▮▰▲▶▼◀◢◣◤◥ + ☄★☠☢☣♻⚙⚛⚠⚡✪❇❈❤ + 🌌🌍🌎🌏👽💡📡🔋🔧🔫🔭🚀 + 😁😃😄😆😇😈😉😊😎😐😒😕 + 😘😛😝😞😟😠😣😭😮😲😴😵 + + Xolonium 2.0.1 2013-07-12 Severin Meyer + Reorganised and simplified files + + Xolonium 2.0 2012-08-11 Severin Meyer + Revised bends + Revised thickness of uppercase diagonal stems + Revised diacritical marks + Revised hints and PS Private Dictionary + Revised glyphs: + *1469@DPRly{}§©®¶ÐÞƒΘΞαεζνξνυЄЉЊ + ЏБЗЛУЧЪЫЬЭЯбзлчъыьэяєљњџ•€∂∙√∞∫≠ + Completed glyph sets: + Adobe Latin 3 + OpenType World Glyph Set 1 (W1G) + Ghostscript Standard (ghostscript-fonts-std-8.11) + Added OpenType kern feature + Added Xolonium-Bold + + Xolonium 1.2 2011-02-12 Severin Meyer + Revised glyphs: + D·Ðı + Completed glyph sets: + ISO 8859-7 (Greek) + Unicode Latin Extended-A block + Added glyphs: + †‡•…‰⁄™∂∑−√∞≠≤≥ + + Xolonium 1.1 2011-01-17 Severin Meyer + Revised placement of cedilla and ogonek in accented glyphs + Revised glyphs: + ,;DKTjkvwxy¥§Ð˛€ + Completed glyph sets: + ISO 8859-2 (Central European) + ISO 8859-3 (South European, Esperanto) + ISO 8859-4 (North European) + ISO 8859-5 (Cyrillic) + ISO 8859-9 (Turkish) + ISO 8859-10 (Nordic) + ISO 8859-13 (Baltic Rim) + ISO 8859-14 (Celtic) + ISO 8859-16 (South-Eastern European) + Added glyphs: + ȷʼ̒ ЀЍѐѝ‒–—‘’‚‛“”„‟‹› + + Xolonium 1.0 2011-01-04 Severin Meyer + Completed glyph sets: + ISO 8859-1 (Western European) + ISO 8859-15 (Western European) + Added glyphs: + ĄĆĘŁŃŚŹŻąćęłńśźżıˆˇ˙˚˛˜ diff --git a/cpp/dodge_the_creeps/project/fonts/LICENSE.txt b/cpp/dodge_the_creeps/project/fonts/LICENSE.txt new file mode 100644 index 0000000..cd6cd46 --- /dev/null +++ b/cpp/dodge_the_creeps/project/fonts/LICENSE.txt @@ -0,0 +1,94 @@ +Copyright 2011-2016 Severin Meyer , +with Reserved Font Name Xolonium. + +This Font Software is licensed under the SIL Open Font License, +Version 1.1. This license is copied below, and is also available +with a FAQ at + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpp/dodge_the_creeps/project/fonts/Xolonium-Regular.ttf b/cpp/dodge_the_creeps/project/fonts/Xolonium-Regular.ttf new file mode 100644 index 0000000..031d627 Binary files /dev/null and b/cpp/dodge_the_creeps/project/fonts/Xolonium-Regular.ttf differ diff --git a/cpp/dodge_the_creeps/project/gdnative/dodge_the_creeps.gdnlib b/cpp/dodge_the_creeps/project/gdnative/dodge_the_creeps.gdnlib new file mode 100644 index 0000000..a54fa56 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/dodge_the_creeps.gdnlib @@ -0,0 +1,18 @@ +[general] + +singleton=false +load_once=true +symbol_prefix="godot_" +reloadable=true + +[entry] + +Windows.64="res://gdnative/windows/libdodgethecreeps.dll" +X11.64="res://gdnative/linux/libdodgethecreeps.so" +OSX.64="res://gdnative/osx/libdodgethecreeps.dylib" + +[dependencies] + +Windows.64=[ ] +X11.64=[ ] +OSX.64=[ ] diff --git a/cpp/dodge_the_creeps/project/gdnative/hud.gdns b/cpp/dodge_the_creeps/project/gdnative/hud.gdns new file mode 100644 index 0000000..3cb92c6 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/hud.gdns @@ -0,0 +1,9 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://gdnative/dodge_the_creeps.gdnlib" type="GDNativeLibrary" id=1] + +[resource] + +resource_name = "HUD" +class_name = "HUD" +library = ExtResource( 1 ) diff --git a/cpp/dodge_the_creeps/project/gdnative/linux/.gitignore b/cpp/dodge_the_creeps/project/gdnative/linux/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/linux/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/cpp/dodge_the_creeps/project/gdnative/main.gdns b/cpp/dodge_the_creeps/project/gdnative/main.gdns new file mode 100644 index 0000000..bc5b99c --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/main.gdns @@ -0,0 +1,9 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://gdnative/dodge_the_creeps.gdnlib" type="GDNativeLibrary" id=1] + +[resource] + +resource_name = "Main" +class_name = "Main" +library = ExtResource( 1 ) diff --git a/cpp/dodge_the_creeps/project/gdnative/mob.gdns b/cpp/dodge_the_creeps/project/gdnative/mob.gdns new file mode 100644 index 0000000..dbec30e --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/mob.gdns @@ -0,0 +1,9 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://gdnative/dodge_the_creeps.gdnlib" type="GDNativeLibrary" id=1] + +[resource] + +resource_name = "Mob" +class_name = "Mob" +library = ExtResource( 1 ) diff --git a/cpp/dodge_the_creeps/project/gdnative/osx/.gitignore b/cpp/dodge_the_creeps/project/gdnative/osx/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/osx/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/cpp/dodge_the_creeps/project/gdnative/player.gdns b/cpp/dodge_the_creeps/project/gdnative/player.gdns new file mode 100644 index 0000000..f3d3dc8 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/player.gdns @@ -0,0 +1,9 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://gdnative/dodge_the_creeps.gdnlib" type="GDNativeLibrary" id=1] + +[resource] + +resource_name = "Player" +class_name = "Player" +library = ExtResource( 1 ) diff --git a/cpp/dodge_the_creeps/project/gdnative/windows/.gitignore b/cpp/dodge_the_creeps/project/gdnative/windows/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/cpp/dodge_the_creeps/project/gdnative/windows/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/cpp/dodge_the_creeps/project/icon.png b/cpp/dodge_the_creeps/project/icon.png new file mode 100644 index 0000000..d1e35a0 Binary files /dev/null and b/cpp/dodge_the_creeps/project/icon.png differ diff --git a/cpp/dodge_the_creeps/project/icon.png.import b/cpp/dodge_the_creeps/project/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/cpp/dodge_the_creeps/project/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/cpp/dodge_the_creeps/project/project.godot b/cpp/dodge_the_creeps/project/project.godot new file mode 100644 index 0000000..81aa1c5 --- /dev/null +++ b/cpp/dodge_the_creeps/project/project.godot @@ -0,0 +1,63 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +[application] + +config/name="Dodge the Creeps with GDNative C++" +config/description="This is a simple game where your character must move +and avoid the enemies for as long as possible. + +This is a finished version of the game featured in the 'Your first game' +tutorial in the documentation. For more details, consider +following the tutorial in the documentation." +run/main_scene="res://Main.tscn" +config/icon="res://icon.png" + +[display] + +window/size/width=480 +window/size/height=720 +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[input] + +move_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) + ] +} +move_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) + ] +} +move_up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) + ] +} +move_down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) + ] +} diff --git a/cpp/dodge_the_creeps/src/entry.cpp b/cpp/dodge_the_creeps/src/entry.cpp new file mode 100644 index 0000000..82453dd --- /dev/null +++ b/cpp/dodge_the_creeps/src/entry.cpp @@ -0,0 +1,23 @@ +#include + +#include "hud.hpp" +#include "main.hpp" +#include "mob.hpp" +#include "player.hpp" + +extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) { + godot::Godot::gdnative_init(o); +} + +extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) { + godot::Godot::gdnative_terminate(o); +} + +extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) { + godot::Godot::nativescript_init(handle); + + godot::register_class(); + godot::register_class
(); + godot::register_class(); + godot::register_class(); +} diff --git a/cpp/dodge_the_creeps/src/hud.cpp b/cpp/dodge_the_creeps/src/hud.cpp new file mode 100644 index 0000000..60e7c64 --- /dev/null +++ b/cpp/dodge_the_creeps/src/hud.cpp @@ -0,0 +1,55 @@ +#include "hud.hpp" + +void HUD::_ready() { + _score_label = get_node("ScoreLabel"); + _message_label = get_node("MessageLabel"); + _start_message_timer = get_node("StartMessageTimer"); + _get_ready_message_timer = get_node("GetReadyMessageTimer"); + _start_button = get_node("StartButton"); + _start_button_timer = get_node("StartButtonTimer"); +} + +// There is no `yield` in GDNative, so we need to have every +// step be its own method that is called on timer timeout. +void HUD::show_get_ready() { + _message_label->set_text("Get Ready"); + _message_label->show(); + _get_ready_message_timer->start(); +} + +void HUD::show_game_over() { + _message_label->set_text("Game Over"); + _message_label->show(); + _start_message_timer->start(); +} + +void HUD::update_score(int p_score) { + _score_label->set_text(godot::Variant(p_score)); +} + +void HUD::_on_StartButton_pressed() { + _start_button_timer->stop(); + _start_button->hide(); + emit_signal("start_game"); +} + +void HUD::_on_StartMessageTimer_timeout() { + _message_label->set_text("Dodge the\nCreeps"); + _message_label->show(); + _start_button_timer->start(); +} + +void HUD::_on_GetReadyMessageTimer_timeout() { + _message_label->hide(); +} + +void HUD::_register_methods() { + godot::register_method("_ready", &HUD::_ready); + godot::register_method("show_get_ready", &HUD::show_get_ready); + godot::register_method("show_game_over", &HUD::show_game_over); + godot::register_method("update_score", &HUD::update_score); + godot::register_method("_on_StartButton_pressed", &HUD::_on_StartButton_pressed); + godot::register_method("_on_StartMessageTimer_timeout", &HUD::_on_StartMessageTimer_timeout); + godot::register_method("_on_GetReadyMessageTimer_timeout", &HUD::_on_GetReadyMessageTimer_timeout); + godot::register_signal("start_game"); +} diff --git a/cpp/dodge_the_creeps/src/hud.hpp b/cpp/dodge_the_creeps/src/hud.hpp new file mode 100644 index 0000000..8852bf6 --- /dev/null +++ b/cpp/dodge_the_creeps/src/hud.hpp @@ -0,0 +1,33 @@ +#ifndef HUD_H +#define HUD_H + +#include +#include +#include +#include +#include + +class HUD : public godot::CanvasLayer { + GODOT_CLASS(HUD, godot::CanvasLayer) + + godot::Label *_score_label; + godot::Label *_message_label; + godot::Timer *_start_message_timer; + godot::Timer *_get_ready_message_timer; + godot::Button *_start_button; + godot::Timer *_start_button_timer; + +public: + void _init() {} + void _ready(); + void show_get_ready(); + void show_game_over(); + void update_score(int score); + void _on_StartButton_pressed(); + void _on_StartMessageTimer_timeout(); + void _on_GetReadyMessageTimer_timeout(); + + static void _register_methods(); +}; + +#endif // HUD_H diff --git a/cpp/dodge_the_creeps/src/main.cpp b/cpp/dodge_the_creeps/src/main.cpp new file mode 100644 index 0000000..7650393 --- /dev/null +++ b/cpp/dodge_the_creeps/src/main.cpp @@ -0,0 +1,80 @@ +#include "main.hpp" + +#include + +#include "mob.hpp" + +void Main::_ready() { + _hud = get_node("HUD"); + _player = get_node("Player"); + _start_position = get_node("StartPosition"); + _mob_spawn_location = get_node("MobPath/MobSpawnLocation"); + _mob_timer = get_node("MobTimer"); + _score_timer = get_node("ScoreTimer"); + _start_timer = get_node("StartTimer"); + _music = get_node("Music"); + _death_sound = get_node("DeathSound"); + _random = (godot::Ref)godot::RandomNumberGenerator::_new(); + _random->randomize(); +} + +void Main::game_over() { + _score_timer->stop(); + _mob_timer->stop(); + _hud->show_game_over(); + _music->stop(); + _death_sound->play(); +} + +void Main::new_game() { + get_tree()->call_group("mobs", "queue_free"); + score = 0; + _player->start(_start_position->get_position()); + _start_timer->start(); + _hud->update_score(score); + _hud->show_get_ready(); + _music->play(); +} + +void Main::_on_MobTimer_timeout() { + // Choose a random location on Path2D. + _mob_spawn_location->set_offset(_random->randi()); + + // Create a Mob instance and add it to the scene. + godot::Node *mob = mob_scene->instance(); + add_child(mob); + + // Set the mob's direction perpendicular to the path direction. + real_t direction = _mob_spawn_location->get_rotation() + Math_PI / 2; + + // Set the mob's position to a random location. + mob->set("position", _mob_spawn_location->get_position()); + + // Add some randomness to the direction. + direction += _random->randf_range(-Math_PI / 4, Math_PI / 4); + mob->set("rotation", direction); + + // Choose the velocity for the mob. + godot::Vector2 velocity = godot::Vector2(_random->randf_range(150.0, 250.0), 0.0); + mob->set("linear_velocity", velocity.rotated(direction)); +} + +void Main::_on_ScoreTimer_timeout() { + score += 1; + _hud->update_score(score); +} + +void Main::_on_StartTimer_timeout() { + _mob_timer->start(); + _score_timer->start(); +} + +void Main::_register_methods() { + godot::register_method("_ready", &Main::_ready); + godot::register_method("game_over", &Main::game_over); + godot::register_method("new_game", &Main::new_game); + godot::register_method("_on_MobTimer_timeout", &Main::_on_MobTimer_timeout); + godot::register_method("_on_ScoreTimer_timeout", &Main::_on_ScoreTimer_timeout); + godot::register_method("_on_StartTimer_timeout", &Main::_on_StartTimer_timeout); + godot::register_property("mob_scene", &Main::mob_scene, (godot::Ref)nullptr); +} diff --git a/cpp/dodge_the_creeps/src/main.hpp b/cpp/dodge_the_creeps/src/main.hpp new file mode 100644 index 0000000..b026577 --- /dev/null +++ b/cpp/dodge_the_creeps/src/main.hpp @@ -0,0 +1,45 @@ +#ifndef MAIN_H +#define MAIN_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hud.hpp" +#include "player.hpp" + +class Main : public godot::Node { + GODOT_CLASS(Main, godot::Node) + + int score; + HUD *_hud; + Player *_player; + godot::Node2D *_start_position; + godot::PathFollow2D *_mob_spawn_location; + godot::Timer *_mob_timer; + godot::Timer *_score_timer; + godot::Timer *_start_timer; + godot::AudioStreamPlayer *_music; + godot::AudioStreamPlayer *_death_sound; + godot::Ref _random; + +public: + godot::Ref mob_scene; + + void _init() {} + void _ready(); + void game_over(); + void new_game(); + void _on_MobTimer_timeout(); + void _on_ScoreTimer_timeout(); + void _on_StartTimer_timeout(); + + static void _register_methods(); +}; + +#endif // MAIN_H diff --git a/cpp/dodge_the_creeps/src/mob.cpp b/cpp/dodge_the_creeps/src/mob.cpp new file mode 100644 index 0000000..7740243 --- /dev/null +++ b/cpp/dodge_the_creeps/src/mob.cpp @@ -0,0 +1,27 @@ +#include "mob.hpp" + +#include +#include + +void Mob::_ready() { + godot::Ref random = godot::RandomNumberGenerator::_new(); + random->randomize(); + _animated_sprite = get_node("AnimatedSprite"); + _animated_sprite->_set_playing(true); + godot::PoolStringArray mob_types = _animated_sprite->get_sprite_frames()->get_animation_names(); + _animated_sprite->set_animation(mob_types[random->randi() % mob_types.size()]); +} + +void Mob::_on_VisibilityNotifier2D_screen_exited() { + queue_free(); +} + +void Mob::_on_start_game() { + queue_free(); +} + +void Mob::_register_methods() { + godot::register_method("_ready", &Mob::_ready); + godot::register_method("_on_VisibilityNotifier2D_screen_exited", &Mob::_on_VisibilityNotifier2D_screen_exited); + godot::register_method("_on_start_game", &Mob::_on_start_game); +} diff --git a/cpp/dodge_the_creeps/src/mob.hpp b/cpp/dodge_the_creeps/src/mob.hpp new file mode 100644 index 0000000..efc8823 --- /dev/null +++ b/cpp/dodge_the_creeps/src/mob.hpp @@ -0,0 +1,25 @@ +#ifndef MOB_H +#define MOB_H + +#include +#include +#include + +class Mob : public godot::RigidBody2D { + GODOT_CLASS(Mob, godot::RigidBody2D) + + godot::AnimatedSprite *_animated_sprite; + +public: + int min_speed = 150; + int max_speed = 250; + + void _init() {} + void _ready(); + void _on_VisibilityNotifier2D_screen_exited(); + void _on_start_game(); + + static void _register_methods(); +}; + +#endif // MOB_H diff --git a/cpp/dodge_the_creeps/src/player.cpp b/cpp/dodge_the_creeps/src/player.cpp new file mode 100644 index 0000000..0b66a6a --- /dev/null +++ b/cpp/dodge_the_creeps/src/player.cpp @@ -0,0 +1,62 @@ +#include "player.hpp" + +#include + +void Player::_ready() { + _animated_sprite = get_node("AnimatedSprite"); + _collision_shape = get_node("CollisionShape2D"); + _screen_size = get_viewport_rect().size; + hide(); +} + +void Player::_process(double p_delta) { + godot::Input *input = godot::Input::get_singleton(); + godot::Vector2 velocity(0, 0); + + velocity.x = input->get_action_strength("move_right") - input->get_action_strength("move_left"); + velocity.y = input->get_action_strength("move_down") - input->get_action_strength("move_up"); + + if (velocity.length() > 0) { + velocity = velocity.normalized() * speed; + _animated_sprite->play(); + } else { + _animated_sprite->stop(); + } + + godot::Vector2 position = get_position(); + position += velocity * p_delta; + position.x = godot::Math::clamp(position.x, (real_t)0.0, _screen_size.x); + position.y = godot::Math::clamp(position.y, (real_t)0.0, _screen_size.y); + set_position(position); + + if (velocity.x != 0) { + _animated_sprite->set_animation("right"); + _animated_sprite->set_flip_v(false); + _animated_sprite->set_flip_h(velocity.x < 0); + } else if (velocity.y != 0) { + _animated_sprite->set_animation("up"); + _animated_sprite->set_flip_v(velocity.y > 0); + } +} + +void Player::start(godot::Vector2 p_position) { + set_position(p_position); + show(); + _collision_shape->set_disabled(false); +} + +void Player::_on_Player_body_entered(godot::Node2D *_body) { + hide(); // Player disappears after being hit. + emit_signal("hit"); + // Must be deferred as we can't change physics properties on a physics callback. + _collision_shape->set_deferred("disabled", true); +} + +void Player::_register_methods() { + godot::register_method("_ready", &Player::_ready); + godot::register_method("_process", &Player::_process); + godot::register_method("start", &Player::start); + godot::register_method("_on_Player_body_entered", &Player::_on_Player_body_entered); + godot::register_property("speed", &Player::speed, 400); + godot::register_signal("hit"); +} diff --git a/cpp/dodge_the_creeps/src/player.hpp b/cpp/dodge_the_creeps/src/player.hpp new file mode 100644 index 0000000..75c52ca --- /dev/null +++ b/cpp/dodge_the_creeps/src/player.hpp @@ -0,0 +1,28 @@ +#ifndef PLAYER_H +#define PLAYER_H + +#include +#include +#include +#include + +class Player : public godot::Area2D { + GODOT_CLASS(Player, godot::Area2D) + + godot::AnimatedSprite *_animated_sprite; + godot::CollisionShape2D *_collision_shape; + godot::Vector2 _screen_size; // Size of the game window. + +public: + int speed = 400; // How fast the player will move (pixels/sec). + + void _init() {} + void _ready(); + void _process(double p_delta); + void start(godot::Vector2 p_position); + void _on_Player_body_entered(godot::Node2D *_body); + + static void _register_methods(); +}; + +#endif // PLAYER_H