Added spikes, Made a way to transition from level to level, and a base level to make level creation easier

This commit is contained in:
2026-02-21 23:53:55 -05:00
parent c3d09c9a88
commit 3b324caf67
15 changed files with 172 additions and 36 deletions

16
AutoLoads/game_manager.gd Normal file
View File

@@ -0,0 +1,16 @@
extends Node
var levels: Dictionary = {
"test1": "uid://dtkg88hfvln2d",
"test2": "uid://b1jbl6gvlvpvy"
}
func reset_level() -> void:
await get_tree().create_timer(1).timeout
get_tree().reload_current_scene()
func change_level(levelName: String) -> void:
print(levels[levelName])
get_tree().change_scene_to_file(levels[levelName])

View File

@@ -0,0 +1 @@
uid://bdcwru17nxvoq

View File

@@ -55,17 +55,9 @@ func player_death() -> void:
Util.add_effect_to_self(self, deathEffect)
queue_free()
func _on_hurt_box_area_entered(area: Area2D) -> void:
#this checks if the area is a bullet
if !area.get_parent().is_in_group("Enemy Bullet"):
return
var body = area.get_parent() as Node
hurt(body)
func _on_hurt_box_body_entered(body: Node2D) -> void:
if !body.is_in_group("Enemy"):
return
hurt(body)
func _on_hurt_box_area_entered(_area: Area2D) -> void:
player_death()
GameManager.reset_level()
func hurt(enemy: Node2D) -> void:
PlayerManager.decress_health(enemy.damage)

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=15 format=3 uid="uid://dm4oirxl6bpnn"]
[ext_resource type="Texture2D" uid="uid://cwwrpe5wfh7ds" path="res://entities/player/player_death_effect/art/spark.png" id="1_335v7"]
[ext_resource type="Script" uid="uid://3g2l2xhvoxj8" path="res://entities/player/player_death_effect/player_death_effect.gd" id="1_i0k0j"]
[ext_resource type="Texture2D" uid="uid://cmp35xmgh574d" path="res://entities/player/player_death_effect/art/partical_effect.png" id="2_ann6r"]
[ext_resource type="Texture2D" uid="uid://cwwrpe5wfh7ds" path="res://Entities/Player/player_death_effect/art/spark.png" id="1_335v7"]
[ext_resource type="Script" uid="uid://3g2l2xhvoxj8" path="res://Entities/Player/player_death_effect/player_death_effect.gd" id="1_i0k0j"]
[ext_resource type="Texture2D" uid="uid://cmp35xmgh574d" path="res://Entities/Player/player_death_effect/art/partical_effect.png" id="2_ann6r"]
[sub_resource type="Gradient" id="Gradient_t8ru6"]
colors = PackedColorArray(0, 1, 1, 1, 0, 0, 1, 1)

View File

@@ -108,15 +108,12 @@ func multiJump():
if Input.is_action_just_pressed("move_jump") and canWallJump:
var boost = 150
print("wall jump")
player.velocity.y = jumpHight
var wallDirection = player.get_wall_normal().x
var direction: float = GameInputEvents.movement_input()
if direction == wallDirection:
print("boost")
player.velocity.x =+ (wallPushBack + boost) * wallDirection
else:
print("no boost")
player.velocity.x =+ wallPushBack * wallDirection
currentJumpCount = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bwxeu131pl2s3"
path="res://.godot/imported/Spike.png-13f97ea10421fafc606f924d5e4938a2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Envoroment/Hazards/Spike/art/Spike.png"
dest_files=["res://.godot/imported/Spike.png-13f97ea10421fafc606f924d5e4938a2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=3 uid="uid://c1jvxh8xwxd77"]
[ext_resource type="Texture2D" uid="uid://bwxeu131pl2s3" path="res://Envoroment/Hazards/Spike/art/Spike.png" id="1_jaub8"]
[node name="Spike" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_jaub8")
[node name="HitBox" type="Area2D" parent="."]
collision_layer = 4
collision_mask = 2
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="HitBox"]
polygon = PackedVector2Array(-8, 8, 0, -8, 8, 8)

View File

@@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://biud0nkyvmlv0"]
[ext_resource type="Script" uid="uid://dorym5b277g7c" path="res://level_transition.gd" id="1_tkgsd"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hwgkx"]
size = Vector2(20, 102)
[node name="LevelTransition" type="Node2D"]
script = ExtResource("1_tkgsd")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(10, -51)
shape = SubResource("RectangleShape2D_hwgkx")
debug_color = Color(0.75157195, 0.19894448, 0.99999994, 0.41960785)
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]

View File

@@ -0,0 +1,32 @@
[gd_scene load_steps=7 format=3 uid="uid://dqldqg0ctdmbn"]
[ext_resource type="PackedScene" uid="uid://ca7jd0ttc0v67" path="res://Entities/Player/player.tscn" id="1_xxuxq"]
[ext_resource type="Texture2D" uid="uid://dauoaulv7uea4" path="res://Envoroment/Levels/art/test_tile.png" id="2_4q1i2"]
[ext_resource type="PackedScene" uid="uid://c1jvxh8xwxd77" path="res://Envoroment/Hazards/Spike/spike.tscn" id="3_rcnev"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_f4wtk"]
texture = ExtResource("2_4q1i2")
0:0/0 = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_f0gh6"]
resource_name = "Hazards"
scenes/1/scene = ExtResource("3_rcnev")
[sub_resource type="TileSet" id="TileSet_pb67c"]
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_f4wtk")
sources/1 = SubResource("TileSetScenesCollectionSource_f0gh6")
[node name="BaseLevel" type="Node2D"]
[node name="Player" parent="." instance=ExtResource("1_xxuxq")]
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Player"]
remote_path = NodePath("../../Camera2D")
[node name="Ground" type="TileMapLayer" parent="."]
tile_set = SubResource("TileSet_pb67c")
[node name="Camera2D" type="Camera2D" parent="."]
position_smoothing_enabled = true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
level_transition.gd Normal file
View File

@@ -0,0 +1,6 @@
extends Node2D
@export var levelName: String
func _on_area_2d_area_entered(area: Area2D) -> void:
GameManager.change_level(levelName)

1
level_transition.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://dorym5b277g7c

View File

@@ -18,6 +18,7 @@ config/icon="res://icon.svg"
[autoload]
PlayerManager="*res://Entities/Player/autoload/player_manager.gd"
GameManager="*res://AutoLoads/game_manager.gd"
[display]
@@ -34,6 +35,7 @@ project/assembly_name="TSA"
[file_customization]
folder_colors={
"res://AutoLoads/": "teal",
"res://Entities/": "orange",
"res://Envoroment/": "yellow",
"res://auto_loads/": "red",
@@ -73,6 +75,12 @@ dash={
]
}
[layer_names]
2d_physics/layer_1="Ground"
2d_physics/layer_2="Player"
2d_physics/layer_3="Hazards"
[physics]
common/physics_interpolation=true