player damage, player death, badguy dictionary, badguy damage, badguy death, user intererface, paler damage animation, player death animation
This commit is contained in:
parent
aea4379c6d
commit
898803a622
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 |
34
assets/Graphics/Player/death/Player Death 64x64.png.import
Normal file
34
assets/Graphics/Player/death/Player Death 64x64.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cfliuywbcr"
|
||||||
|
path="res://.godot/imported/Player Death 64x64.png-4dfb137228b3296b40ff943c26b85b10.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-4dfb137228b3296b40ff943c26b85b10.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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 |
34
assets/Graphics/Player/hurt/Player Hurt 48x48.png.import
Normal file
34
assets/Graphics/Player/hurt/Player Hurt 48x48.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dcpyvssuhqivt"
|
||||||
|
path="res://.godot/imported/Player Hurt 48x48.png-2bb9ccea7c6f3e1bad72c8506d1cd879.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-2bb9ccea7c6f3e1bad72c8506d1cd879.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
|
@ -19,3 +19,5 @@ texture = ExtResource("2_y25gk")
|
|||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("RectangleShape2D_y25gk")
|
shape = SubResource("RectangleShape2D_y25gk")
|
||||||
debug_color = Color(0.690582, 0.49486, 0.146364, 0.42)
|
debug_color = Color(0.690582, 0.49486, 0.146364, 0.42)
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://dm0s1wei11x43"]
|
[gd_scene load_steps=4 format=3 uid="uid://dm0s1wei11x43"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://5njx5bnaw5hh" path="res://assets/Graphics/Objects/crate.png" id="1_b66cd"]
|
[ext_resource type="Texture2D" uid="uid://5njx5bnaw5hh" path="res://assets/Graphics/Objects/crate.png" id="1_b66cd"]
|
||||||
|
[ext_resource type="Script" uid="uid://cov5urwm68y3l" path="res://scripts/crate.gd" id="1_dwt0d"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"]
|
||||||
size = Vector2(20, 19)
|
size = Vector2(20, 19)
|
||||||
|
|
||||||
[node name="RigidBody2D3" type="RigidBody2D"]
|
[node name="RigidBody2D3" type="RigidBody2D"]
|
||||||
|
script = ExtResource("1_dwt0d")
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=19 format=4 uid="uid://dc4obqdsdq81h"]
|
[gd_scene load_steps=20 format=4 uid="uid://dc4obqdsdq81h"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://lbasdkinbtif" path="res://scripts/scene_manager.gd" id="2_p57ef"]
|
[ext_resource type="Script" uid="uid://lbasdkinbtif" path="res://scripts/scene_manager.gd" id="2_p57ef"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cfghfv0tk8mvk" path="res://assets/Graphics/Terrains/Terrain (32x32).png" id="2_u5sy4"]
|
[ext_resource type="Texture2D" uid="uid://cfghfv0tk8mvk" path="res://assets/Graphics/Terrains/Terrain (32x32).png" id="2_u5sy4"]
|
||||||
@ -12,6 +12,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="4_lbhrr"]
|
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="4_lbhrr"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dn48fh70b6v00" path="res://scenes/slime.tscn" id="12_dinhu"]
|
[ext_resource type="PackedScene" uid="uid://dn48fh70b6v00" path="res://scenes/slime.tscn" id="12_dinhu"]
|
||||||
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="13_kvuet"]
|
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="13_kvuet"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cdr5qb57koto1" path="res://scenes/ui.tscn" id="13_trtic"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
||||||
texture = ExtResource("2_u5sy4")
|
texture = ExtResource("2_u5sy4")
|
||||||
@ -438,6 +439,9 @@ tile_set = SubResource("TileSet_0tnpc")
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("2_p57ef")
|
script = ExtResource("2_p57ef")
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("4_lbhrr")]
|
||||||
|
position = Vector2(559, 339)
|
||||||
|
|
||||||
[node name="Crates" type="Node2D" parent="."]
|
[node name="Crates" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="RigidBody2D3" parent="Crates" instance=ExtResource("3_lbhrr")]
|
[node name="RigidBody2D3" parent="Crates" instance=ExtResource("3_lbhrr")]
|
||||||
@ -449,9 +453,6 @@ position = Vector2(570, 193)
|
|||||||
[node name="RigidBody2D5" parent="Crates" instance=ExtResource("3_lbhrr")]
|
[node name="RigidBody2D5" parent="Crates" instance=ExtResource("3_lbhrr")]
|
||||||
position = Vector2(589, 256)
|
position = Vector2(589, 256)
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("4_lbhrr")]
|
|
||||||
position = Vector2(559, 339)
|
|
||||||
|
|
||||||
[node name="triggers" type="Node2D" parent="."]
|
[node name="triggers" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="Area2D" parent="triggers" instance=ExtResource("4_iywne")]
|
[node name="Area2D" parent="triggers" instance=ExtResource("4_iywne")]
|
||||||
@ -498,5 +499,12 @@ position = Vector2(-135, -96)
|
|||||||
[node name="Slime" parent="Enemies" instance=ExtResource("12_dinhu")]
|
[node name="Slime" parent="Enemies" instance=ExtResource("12_dinhu")]
|
||||||
position = Vector2(353, 372)
|
position = Vector2(353, 372)
|
||||||
|
|
||||||
|
[node name="Slime2" parent="Enemies" instance=ExtResource("12_dinhu")]
|
||||||
|
position = Vector2(628, 340)
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Ui" parent="CanvasLayer" instance=ExtResource("13_trtic")]
|
||||||
|
|
||||||
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
||||||
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=18 format=4 uid="uid://dv1n64mv1pt7k"]
|
[gd_scene load_steps=19 format=4 uid="uid://dv1n64mv1pt7k"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d455xj0ubatl" path="res://assets/Graphics/Terrains/forestsky.png" id="1_76toy"]
|
[ext_resource type="Texture2D" uid="uid://d455xj0ubatl" path="res://assets/Graphics/Terrains/forestsky.png" id="1_76toy"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw22wa750snvu" path="res://assets/Graphics/Terrains/forestbackground.png" id="2_8g4ke"]
|
[ext_resource type="Texture2D" uid="uid://cw22wa750snvu" path="res://assets/Graphics/Terrains/forestbackground.png" id="2_8g4ke"]
|
||||||
@ -11,6 +11,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="9_o3sye"]
|
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="9_o3sye"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bu03yhhfncspe" path="res://scenes/trigger.tscn" id="10_24ks5"]
|
[ext_resource type="PackedScene" uid="uid://bu03yhhfncspe" path="res://scenes/trigger.tscn" id="10_24ks5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="11_s4es8"]
|
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="11_s4es8"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cdr5qb57koto1" path="res://scenes/ui.tscn" id="12_8g4ke"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
||||||
texture = ExtResource("4_ve5ok")
|
texture = ExtResource("4_ve5ok")
|
||||||
@ -521,5 +522,9 @@ position = Vector2(-135, -96)
|
|||||||
|
|
||||||
[node name="Enemies" type="Node2D" parent="."]
|
[node name="Enemies" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Ui" parent="CanvasLayer" instance=ExtResource("12_8g4ke")]
|
||||||
|
|
||||||
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
||||||
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=18 format=4 uid="uid://b00ma7dkict7x"]
|
[gd_scene load_steps=19 format=4 uid="uid://b00ma7dkict7x"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d455xj0ubatl" path="res://assets/Graphics/Terrains/forestsky.png" id="1_fh4ka"]
|
[ext_resource type="Texture2D" uid="uid://d455xj0ubatl" path="res://assets/Graphics/Terrains/forestsky.png" id="1_fh4ka"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw22wa750snvu" path="res://assets/Graphics/Terrains/forestbackground.png" id="2_qewby"]
|
[ext_resource type="Texture2D" uid="uid://cw22wa750snvu" path="res://assets/Graphics/Terrains/forestbackground.png" id="2_qewby"]
|
||||||
@ -11,6 +11,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="9_07lh1"]
|
[ext_resource type="PackedScene" uid="uid://dgf4ypom7mnn4" path="res://scenes/player.tscn" id="9_07lh1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bu03yhhfncspe" path="res://scenes/trigger.tscn" id="10_6uuvf"]
|
[ext_resource type="PackedScene" uid="uid://bu03yhhfncspe" path="res://scenes/trigger.tscn" id="10_6uuvf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="11_x008a"]
|
[ext_resource type="PackedScene" uid="uid://can1023a02b8a" path="res://scenes/coin.tscn" id="11_x008a"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cdr5qb57koto1" path="res://scenes/ui.tscn" id="12_qewby"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"]
|
||||||
texture = ExtResource("4_got4s")
|
texture = ExtResource("4_got4s")
|
||||||
@ -494,5 +495,9 @@ position = Vector2(-135, -96)
|
|||||||
|
|
||||||
[node name="Enemies" type="Node2D" parent="."]
|
[node name="Enemies" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Ui" parent="CanvasLayer" instance=ExtResource("12_qewby")]
|
||||||
|
|
||||||
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D" to="." method="_on_areatrigger"]
|
||||||
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
[connection signal="areatrigger" from="triggers/Area2D2" to="." method="_on_areatrigger"]
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
[gd_scene load_steps=28 format=3 uid="uid://dgf4ypom7mnn4"]
|
[gd_scene load_steps=44 format=3 uid="uid://dgf4ypom7mnn4"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dmyw2bn6gnbbv" path="res://scripts/character_body_2d.gd" id="1_4flbx"]
|
[ext_resource type="Script" uid="uid://dmyw2bn6gnbbv" path="res://scripts/character_body_2d.gd" id="1_4flbx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cyc2lhuw8rqjp" path="res://assets/Graphics/Player/Jump/player jump 48x48.png" id="2_dqkch"]
|
[ext_resource type="Texture2D" uid="uid://cyc2lhuw8rqjp" path="res://assets/Graphics/Player/Jump/player jump 48x48.png" id="2_dqkch"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bgoelfb8aet7q" path="res://assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_g2els"]
|
[ext_resource type="Texture2D" uid="uid://bgoelfb8aet7q" path="res://assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_g2els"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dgnq6klmbtmnr" path="res://assets/Graphics/Player/Run/player run 48x48.png" id="3_qhqgy"]
|
[ext_resource type="Texture2D" uid="uid://dgnq6klmbtmnr" path="res://assets/Graphics/Player/Run/player run 48x48.png" id="3_qhqgy"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dcpyvssuhqivt" path="res://assets/Graphics/Player/hurt/Player Hurt 48x48.png" id="4_qlg0r"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cfliuywbcr" path="res://assets/Graphics/Player/death/Player Death 64x64.png" id="4_tuyoq"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8cj0n"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_8cj0n"]
|
||||||
|
|
||||||
@ -59,6 +61,62 @@ region = Rect2(0, 0, 48, 48)
|
|||||||
atlas = ExtResource("2_dqkch")
|
atlas = ExtResource("2_dqkch")
|
||||||
region = Rect2(48, 0, 48, 48)
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_pf23h"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dt7fs"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wqfne"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wnwbv"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gl8cc"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_487ah"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_md1ol"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_bj30b"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jc3p3"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(384, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hax0n"]
|
||||||
|
atlas = ExtResource("4_tuyoq")
|
||||||
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_l71n6"]
|
||||||
|
atlas = ExtResource("4_qlg0r")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ke2ow"]
|
||||||
|
atlas = ExtResource("4_qlg0r")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ujl30"]
|
||||||
|
atlas = ExtResource("4_qlg0r")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_31cv2"]
|
||||||
|
atlas = ExtResource("4_qlg0r")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
||||||
atlas = ExtResource("3_qhqgy")
|
atlas = ExtResource("3_qhqgy")
|
||||||
region = Rect2(0, 0, 48, 48)
|
region = Rect2(0, 0, 48, 48)
|
||||||
@ -149,6 +207,58 @@ animations = [{
|
|||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_pf23h")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dt7fs")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_wqfne")
|
||||||
|
}, {
|
||||||
|
"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")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"death",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_l71n6")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ke2ow")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ujl30")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_31cv2")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"hurt",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_jej6c")
|
"texture": SubResource("AtlasTexture_jej6c")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -192,16 +302,16 @@ target_position = Vector2(21, 0)
|
|||||||
target_position = Vector2(-21, 0)
|
target_position = Vector2(-21, 0)
|
||||||
|
|
||||||
[node name="RightSpawn" type="Node2D" parent="."]
|
[node name="RightSpawn" type="Node2D" parent="."]
|
||||||
position = Vector2(14, -8)
|
position = Vector2(14, -4)
|
||||||
|
|
||||||
[node name="LeftSpawn" type="Node2D" parent="."]
|
[node name="LeftSpawn" type="Node2D" parent="."]
|
||||||
position = Vector2(-14, -8)
|
position = Vector2(-14, -3)
|
||||||
|
|
||||||
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="."]
|
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="."]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
position = Vector2(0, -6)
|
position = Vector2(0, -6)
|
||||||
sprite_frames = SubResource("SpriteFrames_jej6c")
|
sprite_frames = SubResource("SpriteFrames_jej6c")
|
||||||
animation = &"Falling"
|
animation = &"death"
|
||||||
autoplay = "Idle"
|
autoplay = "Idle"
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
@ -1,8 +1,24 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://dn48fh70b6v00"]
|
[gd_scene load_steps=13 format=3 uid="uid://dn48fh70b6v00"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cdlbhjm5t1hwu" path="res://assets/Graphics/enemies/slime_green.png" id="1_371uh"]
|
[ext_resource type="Texture2D" uid="uid://cdlbhjm5t1hwu" path="res://assets/Graphics/enemies/slime_green.png" id="1_371uh"]
|
||||||
[ext_resource type="Script" uid="uid://dunof2t5itkpl" path="res://scripts/slime.gd" id="1_p2gj0"]
|
[ext_resource type="Script" uid="uid://dunof2t5itkpl" path="res://scripts/slime.gd" id="1_p2gj0"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fd6lc"]
|
||||||
|
atlas = ExtResource("1_371uh")
|
||||||
|
region = Rect2(0, 48, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gstla"]
|
||||||
|
atlas = ExtResource("1_371uh")
|
||||||
|
region = Rect2(24, 48, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_v5wyi"]
|
||||||
|
atlas = ExtResource("1_371uh")
|
||||||
|
region = Rect2(48, 48, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0l8pv"]
|
||||||
|
atlas = ExtResource("1_371uh")
|
||||||
|
region = Rect2(72, 48, 24, 24)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_p2gj0"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_p2gj0"]
|
||||||
atlas = ExtResource("1_371uh")
|
atlas = ExtResource("1_371uh")
|
||||||
region = Rect2(0, 24, 24, 24)
|
region = Rect2(0, 24, 24, 24)
|
||||||
@ -23,6 +39,23 @@ region = Rect2(72, 24, 24, 24)
|
|||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fd6lc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_gstla")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_v5wyi")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0l8pv")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"hurt",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_p2gj0")
|
"texture": SubResource("AtlasTexture_p2gj0")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -49,9 +82,8 @@ metadata/_edit_group_ = true
|
|||||||
[node name="slimeGraphic" type="AnimatedSprite2D" parent="."]
|
[node name="slimeGraphic" type="AnimatedSprite2D" parent="."]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
sprite_frames = SubResource("SpriteFrames_fd6lc")
|
sprite_frames = SubResource("SpriteFrames_fd6lc")
|
||||||
animation = &"idle"
|
animation = &"hurt"
|
||||||
autoplay = "idle"
|
autoplay = "idle"
|
||||||
frame_progress = 0.596317
|
|
||||||
|
|
||||||
[node name="RightSideCast" type="RayCast2D" parent="slimeGraphic"]
|
[node name="RightSideCast" type="RayCast2D" parent="slimeGraphic"]
|
||||||
target_position = Vector2(13, 0)
|
target_position = Vector2(13, 0)
|
||||||
|
50
scenes/ui.tscn
Normal file
50
scenes/ui.tscn
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cdr5qb57koto1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://du5ut0qfft7le" 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"]
|
||||||
|
texture_filter = 1
|
||||||
|
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"]
|
||||||
|
texture_filter = 1
|
||||||
|
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"]
|
||||||
|
texture_filter = 1
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Coins "
|
||||||
|
horizontal_alignment = 2
|
@ -1,6 +1,7 @@
|
|||||||
class_name Bullet extends Area2D
|
class_name Bullet extends Area2D
|
||||||
var speed = 700
|
var speed = 700
|
||||||
|
|
||||||
|
signal bulletDamageSignal(body, bullet)
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass
|
pass
|
||||||
@ -10,3 +11,9 @@ func setSpeed(value):
|
|||||||
speed = value
|
speed = value
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
position += transform.x * speed * delta
|
position += transform.x * speed * delta
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_entered(area):
|
||||||
|
print("bullet is hitting area")
|
||||||
|
if area is Slime:
|
||||||
|
bulletDamageSignal.emit(area,self)
|
||||||
|
@ -14,12 +14,15 @@ const JUMP_VELOCITY = -400.0
|
|||||||
enum FaceDirection{LEFT, RIGHT}
|
enum FaceDirection{LEFT, RIGHT}
|
||||||
var facing:FaceDirection = FaceDirection.RIGHT
|
var facing:FaceDirection = FaceDirection.RIGHT
|
||||||
|
|
||||||
enum State{IDLE, RUN, JUMP, FALLING}
|
enum State{IDLE, RUN, JUMP, FALLING, HURT, DEATH}
|
||||||
var current_state:State = State.IDLE
|
var current_state:State = State.IDLE
|
||||||
var pushTarget
|
var pushTarget
|
||||||
var pushEnable = false
|
var pushEnable = false
|
||||||
var direction
|
var direction
|
||||||
var upJump = false
|
var upJump = false
|
||||||
|
|
||||||
|
signal deathAnimationCompleteSignal
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
#game loop
|
#game loop
|
||||||
handle_input()
|
handle_input()
|
||||||
@ -71,15 +74,15 @@ func handle_collisions():
|
|||||||
c.get_collider().apply_central_impulse(-c.get_normal() * 100 )
|
c.get_collider().apply_central_impulse(-c.get_normal() * 100 )
|
||||||
|
|
||||||
if right_cast.is_colliding() && facing == FaceDirection.RIGHT:
|
if right_cast.is_colliding() && facing == FaceDirection.RIGHT:
|
||||||
print("right cast collision")
|
#print("right cast collision")
|
||||||
# get the thing i am colliding with
|
# get the thing i am colliding with
|
||||||
var collider = right_cast.get_collider()
|
var collider = right_cast.get_collider()
|
||||||
if collider is Node && collider is RigidBody2D:
|
if collider is Node && collider is RigidBody2D:
|
||||||
print("i can shove this right")
|
#print("i can shove this right")
|
||||||
pushTarget = collider
|
pushTarget = collider
|
||||||
pushEnable = true
|
pushEnable = true
|
||||||
if left_cast.is_colliding() && facing == FaceDirection.LEFT:
|
if left_cast.is_colliding() && facing == FaceDirection.LEFT:
|
||||||
print("left cast collision")
|
#print("left cast collision")
|
||||||
var collider = left_cast.get_collider()
|
var collider = left_cast.get_collider()
|
||||||
if collider is Node && collider is RigidBody2D:
|
if collider is Node && collider is RigidBody2D:
|
||||||
print("i can shove this left")
|
print("i can shove this left")
|
||||||
@ -113,6 +116,10 @@ func update_animation():
|
|||||||
player_graphic.play("Jump")
|
player_graphic.play("Jump")
|
||||||
State.FALLING:
|
State.FALLING:
|
||||||
player_graphic.play("Falling")
|
player_graphic.play("Falling")
|
||||||
|
State.HURT:
|
||||||
|
player_graphic.play("hurt")
|
||||||
|
State.DEATH:
|
||||||
|
player_graphic.play("death")
|
||||||
func update_states():
|
func update_states():
|
||||||
match current_state:
|
match current_state:
|
||||||
#idle when movment in x
|
#idle when movment in x
|
||||||
@ -135,10 +142,16 @@ func _on_animation_finished() -> void:
|
|||||||
match current_state:
|
match current_state:
|
||||||
State.JUMP:
|
State.JUMP:
|
||||||
upJump = false
|
upJump = false
|
||||||
|
State.HURT:
|
||||||
|
current_state = State.IDLE
|
||||||
|
State.DEATH:
|
||||||
|
deathAnimationCompleteSignal.emit()
|
||||||
|
|
||||||
|
|
||||||
func playerTakesDamage(health):
|
func playerTakesDamage(health):
|
||||||
print("player sees remainting health"+str(health))
|
print("player sees remainting health"+str(health))
|
||||||
|
current_state = State.HURT
|
||||||
func playerDies():
|
func playerDies():
|
||||||
print("player sees he ded.")
|
print("player sees he ded.")
|
||||||
|
current_state = State.DEATH
|
||||||
|
|
||||||
|
@ -13,5 +13,4 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> void:
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
print ("Coin sees collision")
|
|
||||||
coinCollectedSignal.emit(body, self)
|
coinCollectedSignal.emit(body, self)
|
||||||
|
1
scripts/crate.gd
Normal file
1
scripts/crate.gd
Normal file
@ -0,0 +1 @@
|
|||||||
|
class_name Crate extends RigidBody2D
|
1
scripts/crate.gd.uid
Normal file
1
scripts/crate.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://cov5urwm68y3l
|
@ -4,22 +4,27 @@ extends Node2D
|
|||||||
var totalCoinsAvailable = 0
|
var totalCoinsAvailable = 0
|
||||||
|
|
||||||
var timer = Timer.new()
|
var timer = Timer.new()
|
||||||
var timeAvailable = 30
|
var timeAvailable
|
||||||
var level="res://scenes/game.tscn"
|
var level="res://scenes/game.tscn"
|
||||||
var levelTwo = "res://scenes/level2.tscn"
|
var levelTwo = "res://scenes/level2.tscn"
|
||||||
var levels = ["res://scenes/game.tscn","res://scenes/level2.tscn","res://scenes/level3.tscn"]
|
var levels = ["res://scenes/game.tscn","res://scenes/level2.tscn","res://scenes/level3.tscn"]
|
||||||
var timers = [30,20,15]
|
var timers = [30,20,15]
|
||||||
var currentLevel = 0
|
var currentLevel = 0
|
||||||
|
var startingCoins = 0
|
||||||
|
|
||||||
signal destroySignal(body)
|
signal destroySignal(body)
|
||||||
signal levelChangeSignal(level)
|
signal levelChangeSignal(level)
|
||||||
signal playerTakeDamageSignal(health)
|
signal playerTakeDamageSignal(health)
|
||||||
signal playerDiesSignal
|
signal playerDiesSignal
|
||||||
|
signal bulletDamageEnemySignal(body)
|
||||||
|
signal countDownSignal(timeRemaining)
|
||||||
|
signal coinCountSignal(coinsRemaining, startingCoins)
|
||||||
var player:Characterstats
|
var player:Characterstats
|
||||||
var enemy:Characterstats
|
var enemy:Characterstats
|
||||||
|
|
||||||
var playerHealth:int
|
var playerHealth:int
|
||||||
|
|
||||||
|
var enemiesDict = {}
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
player = load("res://scripts/rscs/playerstats.tres")
|
player = load("res://scripts/rscs/playerstats.tres")
|
||||||
@ -36,13 +41,16 @@ func _ready() -> void:
|
|||||||
func secondCounter() -> void:
|
func secondCounter() -> void:
|
||||||
|
|
||||||
timeAvailable -=1
|
timeAvailable -=1
|
||||||
|
countDownSignal.emit(timeAvailable)
|
||||||
if timeAvailable <= 0:
|
if timeAvailable <= 0:
|
||||||
print ("YOU LOSE")
|
print ("YOU LOSE")
|
||||||
#get_tree().call_deferred("change_scene_to_file", levels[currentLevel])
|
#get_tree().call_deferred("change_scene_to_file", levels[currentLevel])
|
||||||
levelChangeSignal.emit(levels[currentLevel])
|
levelChangeSignal.emit(levels[currentLevel])
|
||||||
#reload the current scene
|
#reload the current scene
|
||||||
func reset() -> void:
|
func reset() -> void:
|
||||||
|
startingCoins=0
|
||||||
timeAvailable = timers[currentLevel]
|
timeAvailable = timers[currentLevel]
|
||||||
|
playerHealth = player.starting_health
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
@ -61,25 +69,49 @@ func _on_areatrigger(effect, body) -> void:
|
|||||||
print("player health is now"+str(playerHealth))
|
print("player health is now"+str(playerHealth))
|
||||||
|
|
||||||
func totalCoinCount(totalCoins):
|
func totalCoinCount(totalCoins):
|
||||||
|
if startingCoins == 0:
|
||||||
|
startingCoins = totalCoins
|
||||||
totalCoinsAvailable = totalCoins
|
totalCoinsAvailable = totalCoins
|
||||||
func coinCollected(body, coin):
|
func coinCollected(body, coin):
|
||||||
|
if not body is Crate:
|
||||||
destroySignal.emit(coin)
|
|
||||||
totalCoinsAvailable -= 1
|
destroySignal.emit(coin)
|
||||||
if totalCoinsAvailable <=0:
|
totalCoinsAvailable -= 1
|
||||||
print("YOU WIN")
|
coinCountSignal.emit(totalCoinsAvailable, startingCoins)
|
||||||
currentLevel +=1
|
if totalCoinsAvailable <=0:
|
||||||
if currentLevel >= levels.size():
|
print("YOU WIN")
|
||||||
currentLevel =0
|
currentLevel +=1
|
||||||
|
if currentLevel >= levels.size():
|
||||||
#get_tree().call_deferred("change_scene_to_file", levels[currentLevel])
|
currentLevel =0
|
||||||
levelChangeSignal.emit(levels[currentLevel])
|
|
||||||
|
#get_tree().call_deferred("change_scene_to_file", levels[currentLevel])
|
||||||
|
levelChangeSignal.emit(levels[currentLevel])
|
||||||
|
|
||||||
func playerAttacked(body, slime):
|
func playerAttacked(body, slime):
|
||||||
print("GC knows player attacked")
|
print("GC knows player attacked")
|
||||||
playerHealth -= enemy.meleeDamage
|
playerHealth -= enemiesDict[slime].damage
|
||||||
if playerHealth<=0:
|
if playerHealth<=0:
|
||||||
playerDiesSignal.emit()
|
playerDiesSignal.emit()
|
||||||
else:
|
else:
|
||||||
playerTakeDamageSignal.emit(playerHealth)
|
playerTakeDamageSignal.emit(playerHealth)
|
||||||
|
func playerDead():
|
||||||
|
levelChangeSignal.emit(levels[currentLevel] )
|
||||||
|
|
||||||
|
func bulletDamage(area, bullet):
|
||||||
|
print("Gc Knows bullet hit something"+str(player.rangeDamage))
|
||||||
|
print("GC Knows BG health is :"+str( enemiesDict[area].health))
|
||||||
|
enemiesDict[area].health -= player.rangeDamage
|
||||||
|
if enemiesDict[area].health<=0:
|
||||||
|
destroySignal.emit(area)
|
||||||
|
enemiesDict.erase(area)
|
||||||
|
else:
|
||||||
|
bulletDamageEnemySignal.emit(area)
|
||||||
|
func addEnemyToLevel(slime):
|
||||||
|
var randHealth:int = randi() % 20
|
||||||
|
var randDamage:int = randi() % 10
|
||||||
|
var enemyStat = {
|
||||||
|
"health":enemy.starting_health+ randHealth,
|
||||||
|
"damage":enemy.meleeDamage + randDamage
|
||||||
|
|
||||||
|
}
|
||||||
|
enemiesDict[slime]= enemyStat
|
||||||
|
@ -7,7 +7,8 @@ var totalAllowedBullets = 7
|
|||||||
@onready var coins: Node2D = $"../Coins"
|
@onready var coins: Node2D = $"../Coins"
|
||||||
@onready var enemies: Node2D = $"../Enemies"
|
@onready var enemies: Node2D = $"../Enemies"
|
||||||
@onready var player: Player = $"../Player"
|
@onready var player: Player = $"../Player"
|
||||||
|
@onready var ui = $"../CanvasLayer/Ui"
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Gamecontroller.reset()
|
Gamecontroller.reset()
|
||||||
@ -18,11 +19,19 @@ func _ready() -> void:
|
|||||||
for obj in enemies.get_children():
|
for obj in enemies.get_children():
|
||||||
if obj is Slime:
|
if obj is Slime:
|
||||||
obj.playerDamageSignal.connect(Gamecontroller.playerAttacked)
|
obj.playerDamageSignal.connect(Gamecontroller.playerAttacked)
|
||||||
|
Gamecontroller.addEnemyToLevel(obj)
|
||||||
|
Gamecontroller.bulletDamageEnemySignal.connect(obj.takeDamage)
|
||||||
|
|
||||||
updateCoins()
|
updateCoins()
|
||||||
Gamecontroller.destroySignal.connect(destroyItem)
|
Gamecontroller.destroySignal.connect(destroyItem)
|
||||||
Gamecontroller.levelChangeSignal.connect(changeScene)
|
Gamecontroller.levelChangeSignal.connect(changeScene)
|
||||||
Gamecontroller.playerTakeDamageSignal.connect(player.playerTakesDamage)
|
Gamecontroller.playerTakeDamageSignal.connect(player.playerTakesDamage)
|
||||||
|
if ui:
|
||||||
|
Gamecontroller.playerTakeDamageSignal.connect(ui.healthUpdate)
|
||||||
|
Gamecontroller.countDownSignal.connect(ui.timerUpdate)
|
||||||
|
Gamecontroller.coinCountSignal.connect(ui.coinsUpdate)
|
||||||
Gamecontroller.playerDiesSignal.connect(player.playerDies)
|
Gamecontroller.playerDiesSignal.connect(player.playerDies)
|
||||||
|
player.deathAnimationCompleteSignal.connect(Gamecontroller.playerDead)
|
||||||
#call this anytimes the coins change
|
#call this anytimes the coins change
|
||||||
func updateCoins() ->void:
|
func updateCoins() ->void:
|
||||||
var coinCount = 0
|
var coinCount = 0
|
||||||
@ -43,6 +52,7 @@ func bulletFactory():
|
|||||||
var mybullet
|
var mybullet
|
||||||
if bulletArray.size() < totalAllowedBullets:
|
if bulletArray.size() < totalAllowedBullets:
|
||||||
mybullet = bullet.instantiate()
|
mybullet = bullet.instantiate()
|
||||||
|
mybullet.bulletDamageSignal.connect(Gamecontroller.bulletDamage )
|
||||||
owner.add_child(mybullet)
|
owner.add_child(mybullet)
|
||||||
else:
|
else:
|
||||||
mybullet = bulletArray.pop_back()
|
mybullet = bulletArray.pop_back()
|
||||||
|
@ -5,6 +5,7 @@ class_name Slime extends Area2D
|
|||||||
@onready var left_down_cast: RayCast2D = $"slimeGraphic/Left DownCast"
|
@onready var left_down_cast: RayCast2D = $"slimeGraphic/Left DownCast"
|
||||||
@onready var right_down_cast: RayCast2D = $"slimeGraphic/Right DownCast"
|
@onready var right_down_cast: RayCast2D = $"slimeGraphic/Right DownCast"
|
||||||
|
|
||||||
|
|
||||||
var speed:int = 100
|
var speed:int = 100
|
||||||
var direction = 1
|
var direction = 1
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ func _ready() -> void:
|
|||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
|
||||||
if not right_down_cast.is_colliding():
|
if not right_down_cast.is_colliding():
|
||||||
direction = -1
|
direction = -1
|
||||||
slime_graphic.flip_h = true
|
slime_graphic.flip_h = true
|
||||||
@ -24,15 +26,21 @@ func _process(delta: float) -> void:
|
|||||||
direction = 1
|
direction = 1
|
||||||
slime_graphic.flip_h = false
|
slime_graphic.flip_h = false
|
||||||
if right_side_cast.is_colliding():
|
if right_side_cast.is_colliding():
|
||||||
direction = -1
|
if not right_side_cast.get_collider() is Player && not right_side_cast.get_collider() is Slime:
|
||||||
slime_graphic.flip_h = true
|
direction = -1
|
||||||
|
slime_graphic.flip_h = true
|
||||||
if left_side_cast.is_colliding():
|
if left_side_cast.is_colliding():
|
||||||
direction = 1
|
if not left_side_cast.get_collider() is Player && not left_side_cast.get_collider() is Slime:
|
||||||
slime_graphic.flip_h = false
|
direction = 1
|
||||||
position.x += direction * speed * delta
|
slime_graphic.flip_h = false
|
||||||
|
position.x += direction * speed * delta
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> void:
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
if body is Player:
|
if body is Player:
|
||||||
print("player attacked")
|
print("player attacked")
|
||||||
playerDamageSignal.emit(body, self)
|
playerDamageSignal.emit(body, self)
|
||||||
|
func takeDamage(body):
|
||||||
|
if body == self:
|
||||||
|
slime_graphic.play("hurt")
|
||||||
|
|
||||||
|
17
scripts/ui.gd
Normal file
17
scripts/ui.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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
|
||||||
|
func healthUpdate(healthRemaining):
|
||||||
|
health.text = "Health: "+str(healthRemaining)
|
||||||
|
|
||||||
|
func timerUpdate(timeRemaining):
|
||||||
|
timer.text= str(timeRemaining)
|
||||||
|
func coinsUpdate(coinsRemaining, startingCoins):
|
||||||
|
coins.text="coins: "+str(coinsRemaining)+"/"+str(startingCoins)
|
||||||
|
|
1
scripts/ui.gd.uid
Normal file
1
scripts/ui.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://du5ut0qfft7le
|
Loading…
Reference in New Issue
Block a user