game saving like for real, bad guy movement, player damage, player death, ui with controls labels
This commit is contained in:
parent
d5c87727b9
commit
208d93f5b4
BIN
assets/graphics/player/death/Player Death 64x64.png
Normal file
BIN
assets/graphics/player/death/Player Death 64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
40
assets/graphics/player/death/Player Death 64x64.png.import
Normal file
40
assets/graphics/player/death/Player Death 64x64.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4pynj40whop7"
|
||||
path="res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/death/Player Death 64x64.png"
|
||||
dest_files=["res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.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
|
||||
BIN
assets/graphics/player/hurt/Player Hurt 48x48.png
Normal file
BIN
assets/graphics/player/hurt/Player Hurt 48x48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
40
assets/graphics/player/hurt/Player Hurt 48x48.png.import
Normal file
40
assets/graphics/player/hurt/Player Hurt 48x48.png.import
Normal file
@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n60s2ffy25hc"
|
||||
path="res://.godot/imported/Player Hurt 48x48.png-a720e51cb19103e76b22ab6c1b81302d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/hurt/Player Hurt 48x48.png"
|
||||
dest_files=["res://.godot/imported/Player Hurt 48x48.png-a720e51cb19103e76b22ab6c1b81302d.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
|
||||
@ -66,3 +66,13 @@ chuck={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
save={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
load={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=22 format=4 uid="uid://cy1i6ucex6m0d"]
|
||||
[gd_scene load_steps=23 format=4 uid="uid://cy1i6ucex6m0d"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://qv8blu8wkqvq" path="res://scenes/crate.tscn" id="1_uwrxv"]
|
||||
[ext_resource type="Texture2D" uid="uid://drigbyu4w5ppu" path="res://assets/graphics/environment/terrain/airplane.png" id="2_0tnpc"]
|
||||
@ -12,6 +12,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bgiw80mpxbcgh" path="res://assets/graphics/environment/terrain/veg_32x32.png" id="4_vtaks"]
|
||||
[ext_resource type="Texture2D" uid="uid://bqj8chrd5i5iw" path="res://assets/graphics/environment/terrain/mushroom_32x64.png" id="5_kvpfn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxocmoeuu32ex" path="res://scenes/coin.tscn" id="13_kvuet"]
|
||||
[ext_resource type="PackedScene" uid="uid://ck553kksdq0ku" path="res://scenes/ui.tscn" id="14_ir15t"]
|
||||
[ext_resource type="PackedScene" uid="uid://ccx1uakpj5143" path="res://scenes/slime.tscn" id="14_trtic"]
|
||||
|
||||
[sub_resource type="TileMapPattern" id="TileMapPattern_p57ef"]
|
||||
@ -448,7 +449,7 @@ texture = ExtResource("2_0tnpc")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
texture_filter = 1
|
||||
tile_map_data = PackedByteArray("AAAWAA4AAAAEAAIAAAAWAA0AAAAPAAMAAAAXAA0AAAAQAAQAAAAXAAwAAAAEAAAAAAAZAAwAAAAAAAQAAAAZAAoAAAAAAAQAAAAcAAoAAAACAAQAAAAbAAoAAAABAAQAAAAaAAwAAAAKAAMAAAAbAAwAAAAJAAMAAAAcAAwAAAACAAQAAAAbAA0AAAACAAIAAAAaAA0AAAAAAAIAAAD//wcAAAAAAAAAAAD//wgAAAAAAAIAAAAAAAcAAAABAAAAAAACAAsAAAAAAAAAAAADAAsAAAABAAAAAAAEAAsAAAABAAAAAAAFAAsAAAABAAAAAAAGAAsAAAACAAAAAAAGAAwAAAACAAIAAAAFAAwAAAABAAIAAAAEAAwAAAABAAIAAAADAAwAAAABAAIAAAACAAwAAAAAAAIAAAANAAsAAAACAAQAAAAMAAsAAAABAAQAAAALAAsAAAAAAAQAAAAKAA0AAAACAAQAAAAJAA0AAAAAAAQAAAASAA4AAAACAAQAAAARAA4AAAAPAAMAAAARAA8AAAAEAAIAAAAaAAoAAAABAAQAAAAEABEAAAAAAAAAAAAFABEAAAABAAAAAAAGABEAAAABAAAAAAAHABEAAAABAAAAAAAIABEAAAABAAAAAAAJABEAAAABAAAAAAAKABEAAAABAAAAAAALABEAAAABAAAAAAAMABEAAAABAAAAAAANABEAAAABAAAAAAAOABEAAAABAAAAAAAPABEAAAABAAAAAAAQABEAAAABAAAAAAARABEAAAABAAAAAAASABEAAAABAAAAAAATABEAAAABAAAAAAAUABEAAAABAAAAAAAVABEAAAABAAAAAAAWABEAAAABAAAAAAAXABEAAAABAAAAAAAYABEAAAABAAAAAAAZABEAAAAHAAEAAAAaABEAAAAGAAAAAAAbABEAAAABAAIAAAAcABEAAAABAAIAAAAdABEAAAACAAIAAAAZABAAAAAAAAAAAAAaABAAAAABAAAAAAAbABAAAAABAAAAAAAcABAAAAABAAAAAAAdABAAAAAHAAQAAAAdAA8AAAAE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gAAgAAAAAAAAAEABIAAAAAAAIAAAAFABIAAAABAAIAAAAGABIAAAABAAIAAAAHABIAAAABAAIAAAAIABIAAAABAAIAAAAJABIAAAABAAIAAAAKABIAAAABAAIAAAALABIAAAABAAIAAAAMABIAAAABAAIAAAANABIAAAABAAIAAAAOABIAAAABAAIAAAAPABIAAAABAAIAAAAQABIAAAABAAIAAAARABIAAAABAAIAAAASABIAAAABAAIAAAATABIAAAABAAIAAAAUABIAAAABAAIAAAAVABIAAAABAAIAAAAWABIAAAABAAIAAAAaABIAAAACAAIAAAAZABIAAAABAAIAAAAYABIAAAABAAIAAAAXABIAAAABAAIAAAAKAAsAAAAPAAQAAAAOAAsAAAACAAQAAAAKAAoAAAAEAAAAAAA=")
|
||||
tile_set = SubResource("TileSet_vtaks")
|
||||
|
||||
[node name="SceneManager" type="Node2D" parent="."]
|
||||
@ -480,17 +481,6 @@ metadata/_edit_group_ = true
|
||||
position = Vector2(0, 7.5)
|
||||
shape = SubResource("RectangleShape2D_8cj0n")
|
||||
|
||||
[node name="Crate" parent="." groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(353.8211, 281.4275)
|
||||
|
||||
[node name="Crate2" parent="." groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(445.03278, 293.44574)
|
||||
rotation = -0.7766715
|
||||
|
||||
[node name="Crate3" parent="." groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(254.5908, 285.43356)
|
||||
rotation = 0.51836276
|
||||
|
||||
[node name="Boundary" type="StaticBody2D" parent="."]
|
||||
position = Vector2(400.93042, 633.96295)
|
||||
metadata/_edit_group_ = true
|
||||
@ -505,7 +495,7 @@ position = Vector2(575.3352, 798.21246)
|
||||
position = Vector2(93.216324, 715.08624)
|
||||
intent = "powerup"
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("3_lnu2h")]
|
||||
[node name="Player" parent="." instance=ExtResource("3_lnu2h")]
|
||||
position = Vector2(397.92346, 341.51877)
|
||||
BUMP_POWER = 50
|
||||
|
||||
@ -516,7 +506,7 @@ position = Vector2(192.44662, 340.51724)
|
||||
scale = Vector2(1, 1.0000001)
|
||||
|
||||
[node name="Coin2" parent="Coins" instance=ExtResource("13_kvuet")]
|
||||
position = Vector2(435.00952, 343.5218)
|
||||
position = Vector2(337.78387, 311.4731)
|
||||
scale = Vector2(1, 1.0000001)
|
||||
|
||||
[node name="Enemies" type="Node2D" parent="."]
|
||||
@ -537,5 +527,24 @@ scale = Vector2(1, 1.0000001)
|
||||
position = Vector2(374.86996, 339.51575)
|
||||
scale = Vector2(1, 1.0000001)
|
||||
|
||||
[node name="Crates" type="Node2D" parent="."]
|
||||
|
||||
[node name="Crate" parent="Crates" groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(353.82114, 281.4275)
|
||||
scale = Vector2(1, 1.0000001)
|
||||
|
||||
[node name="Crate2" parent="Crates" groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(479.11194, 288.4382)
|
||||
rotation = -0.7766715
|
||||
scale = Vector2(1.0000001, 1)
|
||||
|
||||
[node name="Crate3" parent="Crates" groups=["pushable", "splodable"] instance=ExtResource("1_uwrxv")]
|
||||
position = Vector2(254.5908, 285.4336)
|
||||
rotation = 0.51836276
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ui" parent="CanvasLayer" instance=ExtResource("14_ir15t")]
|
||||
|
||||
[connection signal="triggerFiredSignal" from="Trigger" to="." method="_on_trigger_fired"]
|
||||
[connection signal="triggerFiredSignal" from="Trigger2" to="." method="_on_trigger_fired"]
|
||||
|
||||
@ -1,17 +1,75 @@
|
||||
[gd_scene load_steps=32 format=3 uid="uid://b1yy0sybg66hh"]
|
||||
[gd_scene load_steps=48 format=3 uid="uid://b1yy0sybg66hh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://kv8w1gwuy3il" path="res://scripts/player.gd" id="1_3vyb7"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4pynj40whop7" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_fjrip"]
|
||||
[ext_resource type="Texture2D" uid="uid://vr36ruu3ew70" path="res://assets/graphics/player/idle/Player Idle 48x48 (1).png" id="2_g2els"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr8leuj7yjpmo" path="res://assets/graphics/player/jumpandfall/player jump 48x48.png" id="2_qhqgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://n60s2ffy25hc" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="3_tuyoq"]
|
||||
[ext_resource type="Texture2D" uid="uid://gat5giebysdj" path="res://assets/graphics/player/run/player run 48x48.png" id="4_dqkch"]
|
||||
[ext_resource type="Texture2D" uid="uid://csmss00eyd21r" path="res://assets/graphics/player/shove/Player Punch 64x64.png" id="5_qlg0r"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_3vyb7"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wnwbv"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gl8cc"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_487ah"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_md1ol"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bj30b"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(192, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jc3p3"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(240, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hax0n"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(288, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t4otl"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(336, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j2b1d"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(384, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cs1tg"]
|
||||
atlas = ExtResource("2_fjrip")
|
||||
region = Rect2(432, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
||||
atlas = ExtResource("2_qhqgy")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_31cv2"]
|
||||
atlas = ExtResource("3_tuyoq")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pf23h"]
|
||||
atlas = ExtResource("3_tuyoq")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dt7fs"]
|
||||
atlas = ExtResource("3_tuyoq")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wqfne"]
|
||||
atlas = ExtResource("3_tuyoq")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
@ -108,6 +166,41 @@ region = Rect2(320, 0, 64, 64)
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wnwbv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gl8cc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_487ah")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_md1ol")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bj30b")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jc3p3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hax0n")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t4otl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j2b1d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cs1tg")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"death",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jej6c")
|
||||
}],
|
||||
"loop": false,
|
||||
@ -116,6 +209,23 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_31cv2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pf23h")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dt7fs")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wqfne")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hurt",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qhqgy")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@ -230,10 +340,8 @@ one_shot = true
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -6)
|
||||
sprite_frames = SubResource("SpriteFrames_jej6c")
|
||||
animation = &"shove"
|
||||
animation = &"death"
|
||||
autoplay = "idle"
|
||||
frame = 1
|
||||
frame_progress = 0.25700366
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2(0, -30)
|
||||
|
||||
@ -45,7 +45,7 @@ size = Vector2(14, 15)
|
||||
[node name="Slime" type="Area2D"]
|
||||
script = ExtResource("1_p2gj0")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
[node name="SlimeGraphic" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_fd6lc")
|
||||
animation = &"idle"
|
||||
|
||||
47
scenes/ui.tscn
Normal file
47
scenes/ui.tscn
Normal file
@ -0,0 +1,47 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://ck553kksdq0ku"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://8ysbh26qa33o" path="res://scripts/ui.gd" id="1_nt7q6"]
|
||||
|
||||
[node name="ui" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_nt7q6")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
grow_horizontal = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="health" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
text = "Health"
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="timer" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Timer"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="coins" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer3"]
|
||||
layout_mode = 2
|
||||
text = "Coins"
|
||||
horizontal_alignment = 2
|
||||
@ -14,12 +14,18 @@ signal levelChangeSignal(level)
|
||||
signal destroySignal(body)
|
||||
signal playerDamagedSignal(health, maxHealth)
|
||||
signal playerDeathSignal
|
||||
signal gameSaveSignal(level, timeRemaining, playerHealth, enemiesDictionary)
|
||||
signal gameLoadSignal(stash)
|
||||
signal countDownSignal(timeRemaining)
|
||||
signal coinUpdateSignal(remainingCoins)
|
||||
|
||||
var enemy:CharacterStats
|
||||
var player:CharacterStats
|
||||
var enemiesDict = {}
|
||||
var playerCurrentHealth:int =0
|
||||
|
||||
var stashData={}
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@ -34,8 +40,11 @@ func _ready():
|
||||
timer.connect("timeout", secondCounter)
|
||||
timer.start()
|
||||
|
||||
|
||||
func secondCounter()->void:
|
||||
timeAvailable -=1
|
||||
countDownSignal.emit(timeAvailable)
|
||||
|
||||
if timeAvailable <=0:
|
||||
print("YOu LOOSAE Baby!")
|
||||
print(levels[currentLevel])
|
||||
@ -48,7 +57,12 @@ func reset()->void:
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
if Input.is_action_just_pressed("save"):
|
||||
print("save the game")
|
||||
saveGame()
|
||||
if Input.is_action_just_pressed("load"):
|
||||
print("load the game")
|
||||
loadGame()
|
||||
|
||||
|
||||
func _on_trigger_fired(intent, body):
|
||||
@ -64,6 +78,7 @@ func _on_coin_collected(body, coin):
|
||||
destroySignal.emit(coin)
|
||||
|
||||
func totalCoins(value):
|
||||
coinUpdateSignal.emit(value)
|
||||
if value == 0:
|
||||
#you won
|
||||
currentLevel +=1
|
||||
@ -83,10 +98,13 @@ func _on_slime_damage(_body, slime):
|
||||
print("Taking damage")
|
||||
playerDamagedSignal.emit(playerCurrentHealth, player.starting_health)
|
||||
|
||||
func deathComplete()->void:
|
||||
levelChangeSignal.emit(levels[currentLevel])
|
||||
|
||||
func totalEnemies(value):
|
||||
print("GC knows total enemies "+str(value))
|
||||
|
||||
func addEnemyToLevel(slime)->void:
|
||||
func addEnemyToLevel(slime, _stat=null)->void:
|
||||
print("GC adding enemy")
|
||||
var randDamage:int = randi() % 10
|
||||
|
||||
@ -94,6 +112,11 @@ func addEnemyToLevel(slime)->void:
|
||||
"health": enemy.health,
|
||||
"damage": enemy.meleeDamage+randDamage
|
||||
}
|
||||
if _stat:
|
||||
enemyStat = {
|
||||
"health":_stat.health,
|
||||
"damage":_stat.damage
|
||||
}
|
||||
enemiesDict[slime]= enemyStat
|
||||
|
||||
func bulletDamage(area,bullet)->void:
|
||||
@ -110,3 +133,25 @@ func bulletDamage(area,bullet)->void:
|
||||
print("enemy damaged")
|
||||
func removeEnemyFromLevel(slime)->void:
|
||||
enemiesDict.erase(slime)
|
||||
|
||||
func saveGame()->void:
|
||||
gameSaveSignal.emit(currentLevel, timeAvailable, playerCurrentHealth, enemiesDict)
|
||||
|
||||
func loadGame()->void:
|
||||
if ResourceLoader.exists("res://scripts/rscs/level"+str(currentLevel)+"_gameSaveStats.tres"):
|
||||
var saved_game:SaveObject = load("res://scripts/rscs/level"+str(currentLevel)+"_gameSaveStats.tres")
|
||||
enemiesDict.clear()
|
||||
#get from loaded game save
|
||||
stashData = saved_game.gameSave
|
||||
print("loading the game")
|
||||
gameLoadSignal.emit(stashData)
|
||||
|
||||
func stashGame(stash)->void:
|
||||
print("stashing game")
|
||||
stashData = stash
|
||||
var stashObject = SaveObject.new()
|
||||
stashObject.gameSave=stashData
|
||||
ResourceSaver.save(stashObject, "res://scripts/rscs/level"+str(currentLevel)+"_gameSaveStats.tres")
|
||||
|
||||
func playerHealth(value)->void:
|
||||
playerCurrentHealth = value
|
||||
|
||||
@ -7,7 +7,7 @@ var direction:float = 0
|
||||
@export var BUMP_POWER = 100
|
||||
enum FaceDirection{LEFT, RIGHT}
|
||||
var facing:FaceDirection = FaceDirection.RIGHT
|
||||
enum State{IDLE,JUMP,FALLING,RUNNING,SHOVE}
|
||||
enum State{IDLE,JUMP,FALLING,RUNNING,SHOVE,HURT,DEATH}
|
||||
var current_state:State = State.IDLE
|
||||
|
||||
@onready var right_cast = $RightCast
|
||||
@ -24,16 +24,24 @@ var upJump:bool = false
|
||||
@export var hard_gravity:float =1.5
|
||||
@onready var player_graphic = $PlayerGraphic
|
||||
|
||||
signal playerDeathCompleteSignal
|
||||
|
||||
func _physics_process(delta):
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
handle_input()
|
||||
if current_state != State.HURT:
|
||||
handle_input()
|
||||
handle_movement(delta)
|
||||
update_states()
|
||||
update_animation()
|
||||
move_and_slide()
|
||||
handle_collisions()
|
||||
|
||||
func handleDamage(_health,_maxHealth)->void:
|
||||
current_state = State.HURT
|
||||
func handleDeath()->void:
|
||||
current_state = State.DEATH
|
||||
|
||||
func update_states()->void:
|
||||
#Create a state machine
|
||||
match current_state:
|
||||
@ -50,6 +58,7 @@ func update_states()->void:
|
||||
State.RUNNING when velocity.x ==0:
|
||||
current_state = State.IDLE
|
||||
|
||||
|
||||
func update_animation()->void:
|
||||
match current_state:
|
||||
State.IDLE:
|
||||
@ -63,6 +72,10 @@ func update_animation()->void:
|
||||
player_graphic.play("run")
|
||||
State.SHOVE:
|
||||
player_graphic.play("shove")
|
||||
State.HURT:
|
||||
player_graphic.play("hurt")
|
||||
State.DEATH:
|
||||
player_graphic.play("death")
|
||||
|
||||
func handle_input()->void:
|
||||
# Handle jump.
|
||||
@ -152,3 +165,7 @@ func _on_animation_finished():
|
||||
upJump=false
|
||||
State.SHOVE:
|
||||
current_state = State.IDLE
|
||||
State.HURT:
|
||||
current_state = State.IDLE
|
||||
State.DEATH:
|
||||
playerDeathCompleteSignal.emit()
|
||||
|
||||
31
scripts/rscs/level0_gameSaveStats.tres
Normal file
31
scripts/rscs/level0_gameSaveStats.tres
Normal file
@ -0,0 +1,31 @@
|
||||
[gd_resource type="Resource" script_class="SaveObject" load_steps=2 format=3 uid="uid://cl4l7yk43rbao"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddp6q3gi13sw1" path="res://scripts/rscs/save_object.gd" id="1_a13pi"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_a13pi")
|
||||
gameSave = {
|
||||
"coinsData": [Transform2D(1, 0, 0, 1.0000001, 435.00952, 343.5218), Transform2D(1, 0, 0, 1.0000001, 192.44662, 340.51724)],
|
||||
"cratesData": [Transform2D(0.00016496716, -1.0015213, 1.0023261, 0.00016483471, 230.14476, 534.2836), Transform2D(-1.0023261, -6.868146e-05, 6.873665e-05, -1.0015213, 486.98053, 534.2846), Transform2D(1.0023259, -0.0007010149, 0.0007015782, 1.0015211, 353.81284, 342.28403)],
|
||||
"enemiesData": [{
|
||||
"damage": 7,
|
||||
"health": 50,
|
||||
"position": Transform2D(1, 0, 0, 1.0000001, 736.34125, 339.51575)
|
||||
}, {
|
||||
"damage": 8,
|
||||
"health": 50,
|
||||
"position": Transform2D(1, 0, 0, 1.0000001, 535.8805, 340.51724)
|
||||
}, {
|
||||
"damage": 8,
|
||||
"health": 50,
|
||||
"position": Transform2D(1, 0, 0, 1.0000001, 483.75943, 339.51572)
|
||||
}, {
|
||||
"damage": 10,
|
||||
"health": 50,
|
||||
"position": Transform2D(1, 0, 0, 1.0000001, 437.652, 339.51575)
|
||||
}],
|
||||
"playerData": {
|
||||
"health": 67.0,
|
||||
"position": Transform2D(1, 0, 0, 1.0000197, 397.92346, 341.94016)
|
||||
}
|
||||
}
|
||||
3
scripts/rscs/save_object.gd
Normal file
3
scripts/rscs/save_object.gd
Normal file
@ -0,0 +1,3 @@
|
||||
class_name SaveObject extends Resource
|
||||
|
||||
@export var gameSave:Dictionary = {}
|
||||
1
scripts/rscs/save_object.gd.uid
Normal file
1
scripts/rscs/save_object.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://ddp6q3gi13sw1
|
||||
@ -7,5 +7,5 @@ script = ExtResource("1_ppipo")
|
||||
health = 50
|
||||
max_health = 50
|
||||
starting_health = 50
|
||||
meleeDamage = 5
|
||||
meleeDamage = 25
|
||||
metadata/_custom_type_script = "uid://oewo8kn4jbkl"
|
||||
|
||||
@ -2,8 +2,15 @@ class_name SceneManager extends Node2D
|
||||
|
||||
var bullet = preload("res://scenes/bullet.tscn")
|
||||
var grenade = preload("res://scenes/grenade.tscn")
|
||||
var coinScene = preload("res://scenes/coin.tscn")
|
||||
var crateScene = preload("res://scenes/crate.tscn")
|
||||
var enemyScene = preload("res://scenes/slime.tscn")
|
||||
|
||||
@onready var coins = $"../Coins"
|
||||
@onready var enemies = $"../Enemies"
|
||||
@onready var player = $"../Player"
|
||||
@onready var crates = $"../Crates"
|
||||
@onready var ui = $"../CanvasLayer/ui"
|
||||
|
||||
|
||||
var bulletArray = []
|
||||
@ -26,6 +33,15 @@ func buildLevel()->void:
|
||||
#Wire up signals from Gamecontroller
|
||||
Gamecontroller.levelChangeSignal.connect(changeScene)
|
||||
Gamecontroller.destroySignal.connect(destroy)
|
||||
Gamecontroller.gameSaveSignal.connect(saveGameByLevel)
|
||||
Gamecontroller.gameLoadSignal.connect(loadGameByLevel)
|
||||
Gamecontroller.playerDamagedSignal.connect(player.handleDamage)
|
||||
Gamecontroller.playerDamagedSignal.connect(ui.healthUpdate)
|
||||
Gamecontroller.playerDeathSignal.connect(player.handleDeath)
|
||||
Gamecontroller.countDownSignal.connect(ui.timerUpdate)
|
||||
Gamecontroller.coinUpdateSignal.connect(ui.coinUpdate)
|
||||
|
||||
player.playerDeathCompleteSignal.connect(Gamecontroller.deathComplete)
|
||||
|
||||
func updateEnemies()->void:
|
||||
var totalEnemies = 0
|
||||
@ -88,3 +104,89 @@ func changeScene(level)->void:
|
||||
|
||||
func destroy(body)->void:
|
||||
body.queue_free()
|
||||
|
||||
func loadGameByLevel(stash)->void:
|
||||
print("load the game")
|
||||
#get the player data from the stash
|
||||
var playerData = stash.playerData
|
||||
var coinsData = stash.coinsData
|
||||
var cratesData = stash.cratesData
|
||||
var enemiesData = stash.enemiesData
|
||||
#get rid of any existing coins
|
||||
if coins:
|
||||
for coin in coins.get_children():
|
||||
#remove the listeners
|
||||
coin.tree_exited.disconnect(updateCoins)
|
||||
coins.remove_child(coin)
|
||||
coin.queue_free()
|
||||
for trans in coinsData:
|
||||
var coinObj:Coin = coinScene.instantiate()
|
||||
coins.add_child(coinObj)
|
||||
coinObj.transform = trans
|
||||
updateCoins()
|
||||
#crates
|
||||
if crates:
|
||||
for crate in crates.get_children():
|
||||
crates.remove_child(crate)
|
||||
crate.queue_free()
|
||||
for crate in cratesData:
|
||||
var crateObj:RigidBody2D = crateScene.instantiate()
|
||||
crates.add_child(crateObj)
|
||||
crateObj.transform = crate
|
||||
#enemies
|
||||
if enemies:
|
||||
for enemy in enemies.get_children():
|
||||
enemies.remove_child(enemy)
|
||||
enemy.queue_free()
|
||||
for enemy in enemiesData:
|
||||
var enemyObj:Slime = enemyScene.instantiate()
|
||||
enemies.add_child(enemyObj)
|
||||
enemyObj.transform = enemy.position
|
||||
Gamecontroller.addEnemyToLevel(enemyObj, enemy)
|
||||
player.transform = playerData.position
|
||||
#tell the game controller the players health
|
||||
Gamecontroller.playerHealth(playerData.health)
|
||||
|
||||
|
||||
|
||||
func saveGameByLevel(currentLevel:int, timeAvailable:int, playerCurrentHealth:float, enemiesDict:Dictionary)->void:
|
||||
print("Saving Game")
|
||||
print(playerCurrentHealth)
|
||||
print(player.transform)
|
||||
var playerData={
|
||||
"health":playerCurrentHealth,
|
||||
"position":player.transform
|
||||
}
|
||||
# coin save info
|
||||
var coinDataArray:Array
|
||||
if coins:
|
||||
for coin in coins.get_children():
|
||||
print(coin.transform)
|
||||
coinDataArray.push_front(coin.transform)
|
||||
var crateDataArray:Array
|
||||
if crates:
|
||||
for crate in crates.get_children():
|
||||
crateDataArray.push_front(crate.transform)
|
||||
|
||||
#enemies
|
||||
var enemyDataArray:Array
|
||||
for enemyKey in enemiesDict:
|
||||
print("ENEMY FOUND")
|
||||
print(enemyKey.transform)
|
||||
print(enemiesDict[enemyKey].health)
|
||||
print(enemiesDict[enemyKey].damage)
|
||||
var enemy={
|
||||
"position":enemyKey.transform,
|
||||
"health":enemiesDict[enemyKey].health,
|
||||
"damage":enemiesDict[enemyKey].damage
|
||||
}
|
||||
enemyDataArray.push_front(enemy)
|
||||
|
||||
var stash={
|
||||
"playerData":playerData,
|
||||
"coinsData": coinDataArray,
|
||||
"cratesData": crateDataArray,
|
||||
"enemiesData":enemyDataArray
|
||||
}
|
||||
|
||||
Gamecontroller.stashGame(stash)
|
||||
|
||||
@ -3,6 +3,7 @@ class_name Slime extends Area2D
|
||||
@onready var left_cast = $LeftCast
|
||||
@onready var right_down_cast = $RightDownCast
|
||||
@onready var left_down_cast = $LeftDownCast
|
||||
@onready var slime_graphic = $SlimeGraphic
|
||||
|
||||
var speed:int = 100
|
||||
var direction = 1
|
||||
@ -15,6 +16,23 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
#raycast detection
|
||||
if not right_down_cast.is_colliding():
|
||||
direction = -1
|
||||
slime_graphic.flip_h = true
|
||||
|
||||
if not left_down_cast.is_colliding():
|
||||
direction = 1
|
||||
slime_graphic.flip_h = false
|
||||
|
||||
if right_cast.is_colliding() && not right_cast.get_collider() is Player:
|
||||
direction = -1
|
||||
slime_graphic.flip_h = true
|
||||
|
||||
if left_cast.is_colliding() && not left_cast.get_collider() is Player:
|
||||
direction = 1
|
||||
slime_graphic.flip_h = false
|
||||
|
||||
position.x += direction * speed * delta
|
||||
|
||||
|
||||
|
||||
23
scripts/ui.gd
Normal file
23
scripts/ui.gd
Normal file
@ -0,0 +1,23 @@
|
||||
class_name UI extends Control
|
||||
@onready var health = $VBoxContainer/HBoxContainer/MarginContainer/health
|
||||
@onready var timer = $VBoxContainer/HBoxContainer/MarginContainer2/timer
|
||||
@onready var coins = $VBoxContainer/HBoxContainer/MarginContainer3/coins
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func healthUpdate(currentHealth, maxHealth):
|
||||
health.text = "Health: "+str(currentHealth)
|
||||
|
||||
func timerUpdate(timeRemaining):
|
||||
timer.text=str(timeRemaining)
|
||||
|
||||
func coinUpdate(coinsRemaining):
|
||||
coins.text = "Coins: "+str(coinsRemaining)
|
||||
1
scripts/ui.gd.uid
Normal file
1
scripts/ui.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://8ysbh26qa33o
|
||||
Loading…
Reference in New Issue
Block a user