we add simple enemy ai and added gamemanager
This commit is contained in:
parent
8ce6a444b7
commit
9a70b862ec
BIN
august26godotcompkieran/Assets/Graphics/Enemies/slime_green.png
Normal file
BIN
august26godotcompkieran/Assets/Graphics/Enemies/slime_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 908 B |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://lpbq4n22w1ig"
|
||||||
|
path="res://.godot/imported/slime_green.png-ebdb998e3765d428d6dd56d872c89a71.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Graphics/Enemies/slime_green.png"
|
||||||
|
dest_files=["res://.godot/imported/slime_green.png-ebdb998e3765d428d6dd56d872c89a71.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
august26godotcompkieran/Assets/Graphics/Pickups/coin.png
Normal file
BIN
august26godotcompkieran/Assets/Graphics/Pickups/coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 B |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://wpp0ajwperl6"
|
||||||
|
path="res://.godot/imported/coin.png-0ccc183d0b7e2d6217ce08e6ae3f2f99.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Graphics/Pickups/coin.png"
|
||||||
|
dest_files=["res://.godot/imported/coin.png-0ccc183d0b7e2d6217ce08e6ae3f2f99.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
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://6qj1h70yjivd"
|
||||||
|
path="res://.godot/imported/Player Death 64x64.png-585c61faad3b9e1142f9ebaa962a0235.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-585c61faad3b9e1142f9ebaa962a0235.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
|
113
august26godotcompkieran/Scenes/Coin.tscn
Normal file
113
august26godotcompkieran/Scenes/Coin.tscn
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
[gd_scene load_steps=17 format=3 uid="uid://cjv23ykm5q7rf"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Sripts/coin.gd" id="1_keqhv"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://wpp0ajwperl6" path="res://Assets/Graphics/Pickups/coin.png" id="1_tuil2"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_r7c6j"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vnnmv"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s2g0s"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(32, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_cs01d"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(48, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gsf1o"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(64, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gkdsi"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(80, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_uxpdn"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(96, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lmo50"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(112, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_1s51c"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(128, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7iqrr"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(144, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7wyft"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(160, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_58t0w"]
|
||||||
|
atlas = ExtResource("1_tuil2")
|
||||||
|
region = Rect2(176, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_6vaah"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_r7c6j")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vnnmv")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_s2g0s")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_cs01d")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_gsf1o")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_gkdsi")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_uxpdn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lmo50")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_1s51c")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7iqrr")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7wyft")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_58t0w")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Idle",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_reynp"]
|
||||||
|
radius = 6.08276
|
||||||
|
|
||||||
|
[node name="Coin" type="Area2D"]
|
||||||
|
script = ExtResource("1_keqhv")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
sprite_frames = SubResource("SpriteFrames_6vaah")
|
||||||
|
animation = &"Idle"
|
||||||
|
autoplay = "Idle"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_reynp")
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=11 format=4 uid="uid://bnrrbkgwh35jy"]
|
[gd_scene load_steps=13 format=4 uid="uid://bnrrbkgwh35jy"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cfqqqoobv1fit" path="res://Assets/Graphics/Environment/Background/forestbackground.png" id="1_02hc3"]
|
[ext_resource type="Texture2D" uid="uid://cfqqqoobv1fit" path="res://Assets/Graphics/Environment/Background/forestbackground.png" id="1_02hc3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bq1tvv23y61by" path="res://Scenes/Crate.tscn" id="1_8ldta"]
|
[ext_resource type="PackedScene" uid="uid://bq1tvv23y61by" path="res://Scenes/Crate.tscn" id="1_8ldta"]
|
||||||
@ -7,6 +7,8 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://b80n7lhw6e1mh" path="res://Assets/Graphics/Environment/Terrain (32x32).png" id="2_hfhl3"]
|
[ext_resource type="Texture2D" uid="uid://b80n7lhw6e1mh" path="res://Assets/Graphics/Environment/Terrain (32x32).png" id="2_hfhl3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://crvsom7i1waff" path="res://Scenes/Player.tscn" id="2_vxspj"]
|
[ext_resource type="PackedScene" uid="uid://crvsom7i1waff" path="res://Scenes/Player.tscn" id="2_vxspj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cb1km20mpc3ag" path="res://Scenes/Trigger.tscn" id="3_sr8fi"]
|
[ext_resource type="PackedScene" uid="uid://cb1km20mpc3ag" path="res://Scenes/Trigger.tscn" id="3_sr8fi"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cjv23ykm5q7rf" path="res://Scenes/Coin.tscn" id="8_6qk41"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dy8nl43lpcmka" path="res://Scenes/Slime.tscn" id="9_tn371"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kvyqi"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kvyqi"]
|
||||||
texture = ExtResource("2_hfhl3")
|
texture = ExtResource("2_hfhl3")
|
||||||
@ -379,6 +381,7 @@ sources/0 = SubResource("TileSetAtlasSource_kvyqi")
|
|||||||
[node name="World" type="Node2D"]
|
[node name="World" type="Node2D"]
|
||||||
|
|
||||||
[node name="Background" type="Parallax2D" parent="."]
|
[node name="Background" type="Parallax2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
repeat_size = Vector2(320, 0)
|
repeat_size = Vector2(320, 0)
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
@ -388,6 +391,7 @@ texture = ExtResource("1_02hc3")
|
|||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="Sprite2D2" type="Sprite2D" parent="Background"]
|
[node name="Sprite2D2" type="Sprite2D" parent="Background"]
|
||||||
|
texture_filter = 1
|
||||||
position = Vector2(160, 90)
|
position = Vector2(160, 90)
|
||||||
texture = ExtResource("2_cpwg1")
|
texture = ExtResource("2_cpwg1")
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
@ -396,8 +400,10 @@ metadata/_edit_group_ = true
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("1_j03ar")
|
script = ExtResource("1_j03ar")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="SceneManager"]
|
||||||
|
|
||||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||||
tile_map_data = PackedByteArray("AAD4/wQAAAAHAAEAAAD5/wQAAAAGAAAAAAD6/wQAAAAGAAEAAAD8/wQAAAABAAAAAAD9/wQAAAANAAMAAAD+/wQAAAAQAAMAAADy/wUAAAAAAAQAAADz/wUAAAABAAQAAAD0/wUAAAABAAQAAAD1/wUAAAAKAAQAAAD2/wUAAAAJAAQAAAD3/wUAAAABAAIAAAD4/wUAAAABAAIAAAD5/wUAAAABAAIAAAD6/wUAAAABAAIAAAD7/wUAAAAJAAQAAAD8/wUAAAABAAIAAAD9/wUAAAABAAIAAAD+/wUAAAAMAAQAAAD//wUAAAABAAQAAAAAAAUAAAABAAQAAAABAAUAAAABAAQAAAACAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAGAAUAAAABAAQAAAAFAAUAAAABAAQAAAAHAAUAAAABAAQAAAAIAAUAAAABAAQAAAANAAUAAAABAAQAAAAMAAUAAAABAAQAAAALAAUAAAABAAQAAAAKAAUAAAABAAQAAAAJAAUAAAABAAQAAAAOAAUAAAACAAQAAAD6/wMAAAACAAAAAAD5/wMAAAAKAAMAAAD4/wMAAAAAAAAAAAD7/wQAAAABAAAAAAD2/wQAAAAGAAEAAAD2/wMAAAACAAEAAAD2/wIAAAACAAAAAAD1/wIAAAAAAAAAAAD1/wMAAAAAAAEAAAD1/wQAAAAAAAEAAAD3/wQAAAAKAAMAAAA=")
|
tile_map_data = PackedByteArray("AAD4/wQAAAAHAAEAAAD5/wQAAAAGAAAAAAD6/wQAAAAGAAEAAAD8/wQAAAABAAAAAAD9/wQAAAANAAMAAAD+/wQAAAAQAAMAAADz/wUAAAAMAAQAAAD0/wUAAAABAAIAAAD1/wUAAAAKAAQAAAD2/wUAAAAJAAQAAAD3/wUAAAABAAIAAAD4/wUAAAABAAIAAAD5/wUAAAABAAIAAAD6/wUAAAABAAIAAAD7/wUAAAAJAAQAAAD8/wUAAAABAAIAAAD9/wUAAAABAAIAAAD+/wUAAAAMAAQAAAD//wUAAAABAAQAAAAAAAUAAAABAAQAAAABAAUAAAABAAQAAAACAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAGAAUAAAABAAQAAAAFAAUAAAABAAQAAAAHAAUAAAABAAQAAAAIAAUAAAABAAQAAAANAAUAAAABAAQAAAAMAAUAAAABAAQAAAALAAUAAAABAAQAAAAKAAUAAAABAAQAAAAJAAUAAAABAAQAAAAOAAUAAAABAAQAAAD6/wMAAAACAAAAAAD5/wMAAAAKAAMAAAD4/wMAAAAAAAAAAAD7/wQAAAABAAAAAAD2/wQAAAAGAAEAAAD2/wMAAAACAAEAAAD2/wIAAAACAAAAAAD1/wIAAAAAAAAAAAD1/wMAAAAAAAEAAAD1/wQAAAAHAAEAAAD3/wQAAAAKAAMAAAD0/wQAAAABAAAAAADz/wQAAAANAAMAAADy/wQAAAANAAMAAADx/wQAAAABAAAAAADw/wQAAAAAAAAAAADy/wUAAAAKAAQAAADx/wUAAAAJAAQAAADw/wUAAAAAAAIAAAAPAAUAAAAQAAQAAAASAAQAAAACAAAAAAAQAAUAAAAAAAIAAAARAAUAAAABAAIAAAASAAUAAAACAAIAAAAPAAQAAAAPAAMAAAAQAAQAAAANAAMAAAARAAQAAAAJAAMAAAA=")
|
||||||
tile_set = SubResource("TileSet_ge2ih")
|
tile_set = SubResource("TileSet_ge2ih")
|
||||||
|
|
||||||
[node name="BottomWorld" type="StaticBody2D" parent="."]
|
[node name="BottomWorld" type="StaticBody2D" parent="."]
|
||||||
@ -431,3 +437,27 @@ metadata/_edit_group_ = true
|
|||||||
[node name="BoxTrapTarget" type="Node2D" parent="."]
|
[node name="BoxTrapTarget" type="Node2D" parent="."]
|
||||||
position = Vector2(321, -49)
|
position = Vector2(321, -49)
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="coins" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="coin" parent="coins" instance=ExtResource("8_6qk41")]
|
||||||
|
position = Vector2(217, 101)
|
||||||
|
|
||||||
|
[node name="coin2" parent="coins" instance=ExtResource("8_6qk41")]
|
||||||
|
position = Vector2(231, 87)
|
||||||
|
|
||||||
|
[node name="coin3" parent="coins" instance=ExtResource("8_6qk41")]
|
||||||
|
position = Vector2(248, 74)
|
||||||
|
|
||||||
|
[node name="coin4" parent="coins" instance=ExtResource("8_6qk41")]
|
||||||
|
position = Vector2(265, 70)
|
||||||
|
|
||||||
|
[node name="Enemies" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Slime" parent="Enemies" instance=ExtResource("9_tn371")]
|
||||||
|
position = Vector2(499, 115)
|
||||||
|
|
||||||
|
[node name="Slime2" parent="Enemies" instance=ExtResource("9_tn371")]
|
||||||
|
position = Vector2(59, 146)
|
||||||
|
|
||||||
|
[connection signal="timeout" from="SceneManager/Timer" to="SceneManager" method="resetworld"]
|
||||||
|
@ -1,10 +1,51 @@
|
|||||||
[gd_scene load_steps=28 format=3 uid="uid://crvsom7i1waff"]
|
[gd_scene load_steps=39 format=3 uid="uid://crvsom7i1waff"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Sripts/player.gd" id="1_jdiv6"]
|
[ext_resource type="Script" path="res://Sripts/player.gd" id="1_jdiv6"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6qj1h70yjivd" path="res://Assets/Graphics/Player/Death/Player Death 64x64.png" id="2_4fy80"]
|
||||||
[ext_resource type="Texture2D" uid="uid://csjeohonmkkov" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_ow1rs"]
|
[ext_resource type="Texture2D" uid="uid://csjeohonmkkov" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_ow1rs"]
|
||||||
[ext_resource type="Texture2D" uid="uid://4b3eimvxs4xa" path="res://Assets/Graphics/Player/Jump/player jump 48x48.png" id="3_d7uya"]
|
[ext_resource type="Texture2D" uid="uid://4b3eimvxs4xa" path="res://Assets/Graphics/Player/Jump/player jump 48x48.png" id="3_d7uya"]
|
||||||
[ext_resource type="Texture2D" uid="uid://7jk3tlc1nyw2" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_kgjol"]
|
[ext_resource type="Texture2D" uid="uid://7jk3tlc1nyw2" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_kgjol"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_h2ctk"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_33q0u"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0y4j2"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_2thpi"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rlvdk"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fulye"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_5bk41"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7im3l"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_kpvqi"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(384, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_55tgt"]
|
||||||
|
atlas = ExtResource("2_4fy80")
|
||||||
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ogmew"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ogmew"]
|
||||||
atlas = ExtResource("2_ow1rs")
|
atlas = ExtResource("2_ow1rs")
|
||||||
region = Rect2(0, 0, 48, 48)
|
region = Rect2(0, 0, 48, 48)
|
||||||
@ -93,6 +134,41 @@ region = Rect2(336, 0, 48, 48)
|
|||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_h2ctk")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_33q0u")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0y4j2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_2thpi")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rlvdk")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fulye")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_5bk41")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7im3l")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_kpvqi")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_55tgt")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"Death",
|
||||||
|
"speed": 7.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ogmew")
|
"texture": SubResource("AtlasTexture_ogmew")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -124,7 +200,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"Idle",
|
"name": &"Idle",
|
||||||
"speed": 15.0
|
"speed": 12.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -167,7 +243,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"Run",
|
"name": &"Run",
|
||||||
"speed": 15.0
|
"speed": 12.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_t5iiu"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_t5iiu"]
|
||||||
@ -179,9 +255,9 @@ script = ExtResource("1_jdiv6")
|
|||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
position = Vector2(0, -6)
|
position = Vector2(0, -6)
|
||||||
sprite_frames = SubResource("SpriteFrames_f8fvt")
|
sprite_frames = SubResource("SpriteFrames_f8fvt")
|
||||||
animation = &"Jump"
|
animation = &"Death"
|
||||||
autoplay = "Idle"
|
autoplay = "Idle"
|
||||||
frame = 1
|
frame = 9
|
||||||
frame_progress = 1.0
|
frame_progress = 1.0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
75
august26godotcompkieran/Scenes/Slime.tscn
Normal file
75
august26godotcompkieran/Scenes/Slime.tscn
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://dy8nl43lpcmka"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Sripts/slime.gd" id="1_2xgu3"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://lpbq4n22w1ig" path="res://Assets/Graphics/Enemies/slime_green.png" id="1_6sd47"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_feiyc"]
|
||||||
|
atlas = ExtResource("1_6sd47")
|
||||||
|
region = Rect2(0, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jvyy4"]
|
||||||
|
atlas = ExtResource("1_6sd47")
|
||||||
|
region = Rect2(24, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_g8dot"]
|
||||||
|
atlas = ExtResource("1_6sd47")
|
||||||
|
region = Rect2(48, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dc6ki"]
|
||||||
|
atlas = ExtResource("1_6sd47")
|
||||||
|
region = Rect2(72, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_kycl6"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_feiyc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jvyy4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_g8dot")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dc6ki")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ujgd7"]
|
||||||
|
size = Vector2(15, 12.5)
|
||||||
|
|
||||||
|
[node name="Slime" type="Area2D"]
|
||||||
|
script = ExtResource("1_2xgu3")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
position = Vector2(0, -2)
|
||||||
|
scale = Vector2(1.2, 1.2)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_kycl6")
|
||||||
|
animation = &"idle"
|
||||||
|
autoplay = "idle"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0, 5.5)
|
||||||
|
scale = Vector2(1.2, 1.2)
|
||||||
|
shape = SubResource("RectangleShape2D_ujgd7")
|
||||||
|
|
||||||
|
[node name="CastRight" type="RayCast2D" parent="."]
|
||||||
|
target_position = Vector2(15, 0)
|
||||||
|
|
||||||
|
[node name="CastLeft" type="RayCast2D" parent="."]
|
||||||
|
target_position = Vector2(-15, 0)
|
||||||
|
|
||||||
|
[node name="CastFloorRight" type="RayCast2D" parent="."]
|
||||||
|
position = Vector2(9, 0)
|
||||||
|
target_position = Vector2(0, 17)
|
||||||
|
|
||||||
|
[node name="CastFloorLeft" type="RayCast2D" parent="."]
|
||||||
|
position = Vector2(-9, 0)
|
||||||
|
target_position = Vector2(0, 17)
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -0,0 +1,5 @@
|
|||||||
|
class_name CharacterStats extends Resource
|
||||||
|
|
||||||
|
@export var max_health:int = 100
|
||||||
|
@export var starting_health:int = 100
|
||||||
|
@export var current_health:int = 100
|
9
august26godotcompkieran/Sripts/Resources/player.tres
Normal file
9
august26godotcompkieran/Sripts/Resources/player.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://sru8awuj2bof"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Sripts/Resources/character_stats.gd" id="1_u5owe"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_u5owe")
|
||||||
|
max_health = 100
|
||||||
|
starting_health = 100
|
||||||
|
current_heath = 100
|
9
august26godotcompkieran/Sripts/Resources/slime.tres
Normal file
9
august26godotcompkieran/Sripts/Resources/slime.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://b7sfi2frc80hf"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Sripts/Resources/character_stats.gd" id="1_arx74"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_arx74")
|
||||||
|
max_health = 50
|
||||||
|
starting_health = 50
|
||||||
|
current_heath = 50
|
17
august26godotcompkieran/Sripts/coin.gd
Normal file
17
august26godotcompkieran/Sripts/coin.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
signal coincollected
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
if body.is_in_group("Player"):
|
||||||
|
coincollected.emit()
|
||||||
|
queue_free()
|
24
august26godotcompkieran/Sripts/game_controller.gd
Normal file
24
august26godotcompkieran/Sripts/game_controller.gd
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var coinscollected:int = 0
|
||||||
|
var player:Resource
|
||||||
|
|
||||||
|
signal playerdeath
|
||||||
|
func _ready() -> void:
|
||||||
|
print("Game Controller is on")
|
||||||
|
player = load("res://Sripts/Resources/player.tres")
|
||||||
|
|
||||||
|
func coincollected():
|
||||||
|
coinscollected +=1
|
||||||
|
print("Gamecontroller Coin Collected : "+str(coinscollected) )
|
||||||
|
func resetplayer():
|
||||||
|
player.current_health = player.max_health
|
||||||
|
|
||||||
|
func playerdamaged():
|
||||||
|
player.current_health -= 20
|
||||||
|
print("player health is : "+str(player.current_health))
|
||||||
|
# is player dead
|
||||||
|
if player.current_health <=0:
|
||||||
|
#Death
|
||||||
|
playerdeath.emit()
|
||||||
|
|
@ -19,7 +19,11 @@ var pushTarget
|
|||||||
|
|
||||||
var bullet = preload("res://Scenes/Bullet.tscn")
|
var bullet = preload("res://Scenes/Bullet.tscn")
|
||||||
|
|
||||||
|
func killplayer():
|
||||||
|
print("dying")
|
||||||
|
#play death
|
||||||
|
playerSprite.play("Death")
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
|
@ -5,6 +5,10 @@ var bulletPool:Array = []
|
|||||||
# crate pool thing
|
# crate pool thing
|
||||||
var cratePool:Array = []
|
var cratePool:Array = []
|
||||||
@onready var box_trap_target: Node2D = $"../BoxTrapTarget"
|
@onready var box_trap_target: Node2D = $"../BoxTrapTarget"
|
||||||
|
@onready var coins: Node = $"../coins"
|
||||||
|
@onready var enemies: Node = $"../Enemies"
|
||||||
|
@onready var player: CharacterBody2D = $"../CharacterBody2D"
|
||||||
|
@onready var deathdelay: Timer = $Timer
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
# pool crates
|
# pool crates
|
||||||
@ -12,6 +16,18 @@ func _ready() -> void:
|
|||||||
if obj.is_in_group("Pushable"):
|
if obj.is_in_group("Pushable"):
|
||||||
cratePool.push_back(obj)
|
cratePool.push_back(obj)
|
||||||
print("Total crate in play: "+str(cratePool.size() ) )
|
print("Total crate in play: "+str(cratePool.size() ) )
|
||||||
|
for n in coins.get_children():
|
||||||
|
# hook up the coincollected signal
|
||||||
|
print("coin found")
|
||||||
|
n.coincollected.connect(GameController.coincollected)
|
||||||
|
# Enemy routine
|
||||||
|
for n in enemies.get_children():
|
||||||
|
if n is Enemy:
|
||||||
|
#wire up the signal
|
||||||
|
n.playerdamage.connect(GameController.playerdamaged)
|
||||||
|
# gamecontroller signals
|
||||||
|
GameController.playerdeath.connect(killplayer)
|
||||||
|
|
||||||
|
|
||||||
func boxTrap():
|
func boxTrap():
|
||||||
print("boxTrap active")
|
print("boxTrap active")
|
||||||
@ -46,3 +62,12 @@ func crateFactory():
|
|||||||
var myCrate = crate.instantiate()
|
var myCrate = crate.instantiate()
|
||||||
myCrate.add_to_group("Pushable")
|
myCrate.add_to_group("Pushable")
|
||||||
return myCrate
|
return myCrate
|
||||||
|
|
||||||
|
func killplayer():
|
||||||
|
print("kill player")
|
||||||
|
player.killplayer()
|
||||||
|
deathdelay.start(1)
|
||||||
|
|
||||||
|
func resetworld():
|
||||||
|
GameController.resetplayer()
|
||||||
|
get_tree().reload_current_scene()
|
||||||
|
39
august26godotcompkieran/Sripts/slime.gd
Normal file
39
august26godotcompkieran/Sripts/slime.gd
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
class_name Enemy extends Area2D
|
||||||
|
|
||||||
|
signal playerdamage
|
||||||
|
@onready var cast_right: RayCast2D = $CastRight
|
||||||
|
@onready var cast_left: RayCast2D = $CastLeft
|
||||||
|
@onready var cast_floor_right: RayCast2D = $CastFloorRight
|
||||||
|
@onready var cast_floor_left: RayCast2D = $CastFloorLeft
|
||||||
|
const speed = 60
|
||||||
|
var direction = 1
|
||||||
|
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if cast_right.is_colliding():
|
||||||
|
if not cast_right.get_collider().is_in_group("Player"):
|
||||||
|
direction = -1
|
||||||
|
sprite.flip_h = true
|
||||||
|
position.x += direction * speed * delta
|
||||||
|
if cast_left.is_colliding():
|
||||||
|
if not cast_left.get_collider().is_in_group("Player"):
|
||||||
|
direction = 1
|
||||||
|
sprite.flip_h = false
|
||||||
|
if not cast_floor_right.is_colliding():
|
||||||
|
direction = -1
|
||||||
|
sprite.flip_h = true
|
||||||
|
if not cast_floor_left.is_colliding():
|
||||||
|
direction = 1
|
||||||
|
sprite.flip_h = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
if body.is_in_group("Player"):
|
||||||
|
playerdamage.emit()
|
||||||
|
|
@ -15,6 +15,10 @@ run/main_scene="res://Scenes/Game.tscn"
|
|||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
GameController="*res://Sripts/game_controller.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=320
|
window/size/viewport_width=320
|
||||||
|
Loading…
Reference in New Issue
Block a user