Skip to content

Squash the creeps branch #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6326c47
add Squash The Creeps tutorial
FrankCasanova Mar 27, 2025
23bf02f
build: add squash-the-creeps project to workspace
FrankCasanova Mar 29, 2025
3d581d4
build: update library paths in RustScripts.gdextension
FrankCasanova Mar 29, 2025
c586349
refactor(player): add Input class import for handling user input
FrankCasanova Mar 29, 2025
f8a66c8
add "rust" in order to run the project
FrankCasanova Mar 29, 2025
0bb88b9
refactor(main_scene): change mob_scene initialization to use OnEditor
FrankCasanova Mar 29, 2025
94ce9cd
replace the manual init to the macro init
FrankCasanova Mar 29, 2025
baac727
remove leftlover
FrankCasanova Mar 29, 2025
003e9c4
add spaces at the start of comments lines
FrankCasanova Mar 29, 2025
655d3af
refactor: update comments and remove redundant initialization code
FrankCasanova Mar 29, 2025
f999400
refactor: simplify initialization using #[init] attribute
FrankCasanova Mar 29, 2025
f76f2f7
refactor(mob): export min_speed and max_speed for easier configuration
FrankCasanova Mar 29, 2025
428f5d5
refactor: improve code readability and spacing in main_scene, mob, an…
FrankCasanova Mar 29, 2025
b870d5e
refactor(player): export player properties for better configurability
FrankCasanova Mar 29, 2025
59517c8
feat(input): add joystick and mouse support for movement and jump act…
FrankCasanova Mar 29, 2025
9040adb
feat: add and update game parameters for mob, player, and main scene
FrankCasanova Mar 29, 2025
7ac5706
docs(main_scene): add TODO comment for broken on_mob_timer_timeout fu…
FrankCasanova Mar 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"dodge-the-creeps/rust",
"hot-reload/rust",
"squash-the-creeps/rust"
]

# Note about Jetbrains IDEs: "IDE Sync" (Refresh Cargo projects) may cause static analysis errors such as
Expand Down
1 change: 1 addition & 0 deletions squash-the-creeps/godot/.godot/extension_list.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
res://RustScripts.gdextension
16 changes: 16 additions & 0 deletions squash-the-creeps/godot/RustScripts.gdextension
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.3
reloadable = true

[libraries]
linux.debug.x86_64 = "res://../../target/debug/libsquash_the_creeps.so"
linux.release.x86_64 = "res://../../target/release/libsquash_the_creeps.so"
windows.debug.x86_64 = "res://../../target/debug/squash_the_creeps.dll"
windows.release.x86_64 = "res://../../target/release/squash_the_creeps.dll"
macos.debug = "res://../../target/debug/libsquash_the_creeps.dylib"
macos.release = "res://../../target/release/libsquash_the_creeps.dylib"
macos.debug.arm64 = "res://../../target/debug/libsquash_the_creeps.dylib"
macos.release.arm64 = "res://../../target/release/libsquash_the_creeps.dylib"
web.debug.wasm32 = "res://../../target/wasm32-unknown-emscripten/debug/squash_the_creeps.wasm"
web.release.wasm32 = "res://../../target/wasm32-unknown-emscripten/release/squash_the_creeps.wasm"
1 change: 1 addition & 0 deletions squash-the-creeps/godot/RustScripts.gdextension.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://7k6rsd6ivfg
Binary file not shown.
Binary file added squash-the-creeps/godot/art/body.material
Binary file not shown.
Binary file added squash-the-creeps/godot/art/eye.material
Binary file not shown.
Binary file added squash-the-creeps/godot/art/mob.glb
Binary file not shown.
Binary file added squash-the-creeps/godot/art/mob_body.material
Binary file not shown.
Binary file added squash-the-creeps/godot/art/mob_eye.material
Binary file not shown.
Binary file added squash-the-creeps/godot/art/player.glb
Binary file not shown.
Binary file added squash-the-creeps/godot/art/pupil.material
Binary file not shown.
3 changes: 3 additions & 0 deletions squash-the-creeps/godot/default_bus_layout.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[gd_resource type="AudioBusLayout" format=2]

[resource]
4 changes: 4 additions & 0 deletions squash-the-creeps/godot/default_env.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[gd_resource type="Environment" format=2]

[resource]
ambient_light_color = Color( 0.341176, 0.341176, 0.466667, 1 )
43 changes: 43 additions & 0 deletions squash-the-creeps/godot/fonts/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat)

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: http://scripts.sil.org/OFL

—————————————————————————————-
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.
Binary file not shown.
Binary file added squash-the-creeps/godot/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions squash-the-creeps/godot/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[gd_scene load_steps=10 format=3 uid="uid://b70g8epauqibi"]

[ext_resource type="PackedScene" uid="uid://d0jx5lcbm76jf" path="res://mob.tscn" id="1_h2yge"]
[ext_resource type="PackedScene" uid="uid://bvlv4saytitbk" path="res://player.tscn" id="1_ig7tw"]
[ext_resource type="FontFile" uid="uid://dl270v4sovdki" path="res://fonts/Montserrat-Medium.ttf" id="2_0xm2m"]

[sub_resource type="BoxShape3D" id="BoxShape3D_7dm0k"]
size = Vector3(60, 2, 60)

[sub_resource type="BoxMesh" id="BoxMesh_ig7tw"]
size = Vector3(60, 2, 60)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ig7tw"]
albedo_color = Color(0.937816, 0, 0.125279, 1)

[sub_resource type="CylinderMesh" id="CylinderMesh_0xm2m"]
material = SubResource("StandardMaterial3D_ig7tw")

[sub_resource type="Curve3D" id="Curve3D_ig7tw"]
closed = true
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, -14.9857, 0, -14.0101, 0, 0, 0, 0, 0, 0, 12.0963, 0, -14.9296, 0, 0, 0, 0, 0, 0, 16.9048, 0, 18.8654, 0, 0, 0, 0, 0, 0, -16.1414, 0, 20.7598),
"tilts": PackedFloat32Array(0, 0, 0, 0)
}
point_count = 4

[sub_resource type="Theme" id="Theme_h2yge"]
default_font = ExtResource("2_0xm2m")
default_font_size = 22

[node name="Main" type="MainScene"]
mob_scene = ExtResource("1_h2yge")

[node name="Ground" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
collision_layer = 4
collision_mask = 0
metadata/_edit_group_ = true

[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
shape = SubResource("BoxShape3D_7dm0k")

[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
mesh = SubResource("BoxMesh_ig7tw")

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.25, -0.476727, 0.842752, -0.0669873, 0.85979, 0.506236, -0.965926, -0.183013, 0.183013, 0, 23, 0)
light_energy = 2.293
light_specular = 2.455
shadow_enabled = true
directional_shadow_blend_splits = true

[node name="Player" parent="." instance=ExtResource("1_ig7tw")]

[node name="Marker3D" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 5, 0)

[node name="Camera3D" type="Camera3D" parent="Marker3D"]
transform = Transform3D(1, 0, 0, 0, 1, -2.98023e-08, 0, 2.98023e-08, 1, 0, -5, 19)
projection = 1
current = true
size = 19.19

[node name="Cylinders" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18, 0, -14)

[node name="MeshInstance3D" type="MeshInstance3D" parent="Cylinders"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0)
mesh = SubResource("CylinderMesh_0xm2m")

[node name="MeshInstance3D2" type="MeshInstance3D" parent="Cylinders"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 35)
mesh = SubResource("CylinderMesh_0xm2m")

[node name="MeshInstance3D3" type="MeshInstance3D" parent="Cylinders"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 33)
mesh = SubResource("CylinderMesh_0xm2m")

[node name="MeshInstance3D4" type="MeshInstance3D" parent="Cylinders"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 30, 0, -1)
mesh = SubResource("CylinderMesh_0xm2m")

[node name="SpawnPath" type="Path3D" parent="."]
curve = SubResource("Curve3D_ig7tw")

[node name="SpawnLocation" type="PathFollow3D" parent="SpawnPath"]
transform = Transform3D(0.0339328, 0, -0.999424, 0, 1, 0, 0.999424, 0, 0.0339328, -14.9857, 0, -14.0101)

[node name="MobTimer" type="Timer" parent="."]
wait_time = 0.5
autostart = true

[node name="UserInterface" type="UserInterface" parent="."]
physics_interpolation_mode = 0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("Theme_h2yge")

[node name="ScoreLabel" type="Label" parent="UserInterface"]
layout_mode = 0
offset_left = 37.0
offset_top = 45.0
offset_right = 98.0
offset_bottom = 68.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "Score: 0"

[node name="Retry" type="ColorRect" parent="UserInterface"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.0705882, 0.121569, 0.152941, 0.380392)

[node name="Label" type="Label" parent="UserInterface/Retry"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -92.5
offset_top = -14.0
offset_right = 92.5
offset_bottom = 14.0
grow_horizontal = 2
grow_vertical = 2
text = "Press enter retry"

[connection signal="timeout" from="MobTimer" to="." method="on_mob_timer_timeout"]
68 changes: 68 additions & 0 deletions squash-the-creeps/godot/mob.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[gd_scene load_steps=5 format=3 uid="uid://d0jx5lcbm76jf"]

[ext_resource type="PackedScene" uid="uid://or56hj80wrrn" path="res://art/mob.glb" id="1_dy6sc"]

[sub_resource type="BoxShape3D" id="BoxShape3D_nokgg"]
size = Vector3(1.40546, 1.45325, 1.70323)

[sub_resource type="Animation" id="Animation_dy6sc"]
resource_name = "float"
length = 1.2
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Pivot/Character:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.3, 0.7),
"transitions": PackedFloat32Array(0.482968, 2),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0, 0.65, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Pivot/Character:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1, 0.5),
"transitions": PackedFloat32Array(0.267943, 1.62451),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0.139626, 0, 0)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_nokgg"]
_data = {
&"float": SubResource("Animation_dy6sc")
}

[node name="Mob" type="Mob" groups=["mob"]]
min_speed = 10.0
max_speed = 18.0
collision_layer = 2
collision_mask = 0

[node name="Pivot" type="Node3D" parent="."]

[node name="Character" parent="Pivot" instance=ExtResource("1_dy6sc")]
transform = Transform3D(1, 0, 0, 0, 0.99963, -0.0272248, 0, 0.0272248, 0.99963, 0, 0.396094, 0)

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0510979, 0.226624, -0.0277531)
shape = SubResource("BoxShape3D_nokgg")

[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="."]
transform = Transform3D(1.55638, 0, 0, 0, 1, 0, 0, 0, 1.86618, 0, 0, 0)
visible = false
aabb = AABB(-0.857277, -1, -1.03447, 1.71455, 2, 2.06894)

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_nokgg")
}
autoplay = "float"

[connection signal="screen_exited" from="VisibleOnScreenNotifier3D" to="." method="on_visible_on_screen_notifier_3d_screen_exited"]
7 changes: 7 additions & 0 deletions squash-the-creeps/godot/music_player.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://bjvmnxjbg7sfm"]

[ext_resource type="AudioStream" uid="uid://de3ihy6kdsw2x" path="res://art/House In a Forest Loop.ogg" id="1_fvyft"]

[node name="MusicPlayer" type="AudioStreamPlayer"]
stream = ExtResource("1_fvyft")
autoplay = true
Loading
Loading