enemies, gamecontroller, playerdeath, coins
This commit is contained in:
parent
d84835dab2
commit
5ca3a193d1
BIN
fabigame/assets/graphics/enemies/slime_green.png
Normal file
BIN
fabigame/assets/graphics/enemies/slime_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 908 B |
34
fabigame/assets/graphics/enemies/slime_green.png.import
Normal file
34
fabigame/assets/graphics/enemies/slime_green.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://grew2f48lbpx"
|
||||
path="res://.godot/imported/slime_green.png-5261ffd1254c816fe62b35227a9aa11d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/enemies/slime_green.png"
|
||||
dest_files=["res://.godot/imported/slime_green.png-5261ffd1254c816fe62b35227a9aa11d.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
fabigame/assets/graphics/pickups/coin.png
Normal file
BIN
fabigame/assets/graphics/pickups/coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 B |
34
fabigame/assets/graphics/pickups/coin.png.import
Normal file
34
fabigame/assets/graphics/pickups/coin.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://2alfmycos3hc"
|
||||
path="res://.godot/imported/coin.png-f0b33289d8d72c34d5a0c76da4c0f19c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/pickups/coin.png"
|
||||
dest_files=["res://.godot/imported/coin.png-f0b33289d8d72c34d5a0c76da4c0f19c.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
fabigame/assets/graphics/player/dead/Player Death 64x64.png
Normal file
BIN
fabigame/assets/graphics/player/dead/Player Death 64x64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://385u5ioc15bk"
|
||||
path="res://.godot/imported/Player Death 64x64.png-a1335d3f0d31c2c547d022fdb8875398.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/dead/Player Death 64x64.png"
|
||||
dest_files=["res://.godot/imported/Player Death 64x64.png-a1335d3f0d31c2c547d022fdb8875398.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
fabigame/assets/graphics/player/hurt/Player Hurt 48x48.png
Normal file
BIN
fabigame/assets/graphics/player/hurt/Player Hurt 48x48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://1tiutqy11mhk"
|
||||
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/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
|
@ -15,6 +15,10 @@ run/main_scene="res://scenes/game.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
GameController="*res://scripts/game_controller.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=320
|
||||
|
73
fabigame/scenes/badguy.tscn
Normal file
73
fabigame/scenes/badguy.tscn
Normal file
@ -0,0 +1,73 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://b0pun5awvst0k"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://grew2f48lbpx" path="res://assets/graphics/enemies/slime_green.png" id="1_55ykq"]
|
||||
[ext_resource type="Script" path="res://scripts/badguy.gd" id="1_i2hx4"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qpxa3"]
|
||||
atlas = ExtResource("1_55ykq")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3sedu"]
|
||||
atlas = ExtResource("1_55ykq")
|
||||
region = Rect2(24, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hmqye"]
|
||||
atlas = ExtResource("1_55ykq")
|
||||
region = Rect2(48, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i8j10"]
|
||||
atlas = ExtResource("1_55ykq")
|
||||
region = Rect2(72, 24, 24, 24)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_lk04i"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qpxa3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3sedu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hmqye")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i8j10")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_88k5w"]
|
||||
size = Vector2(14, 14)
|
||||
|
||||
[node name="Area2D" type="Area2D"]
|
||||
script = ExtResource("1_i2hx4")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_lk04i")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.696237
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 5)
|
||||
shape = SubResource("RectangleShape2D_88k5w")
|
||||
|
||||
[node name="CastRight" type="RayCast2D" parent="."]
|
||||
target_position = Vector2(14, 0)
|
||||
|
||||
[node name="CastLeft" type="RayCast2D" parent="."]
|
||||
target_position = Vector2(-14, 0)
|
||||
|
||||
[node name="CastFloorRight" type="RayCast2D" parent="."]
|
||||
position = Vector2(9, 5)
|
||||
target_position = Vector2(0, 13)
|
||||
|
||||
[node name="CastFloorLeft" type="RayCast2D" parent="."]
|
||||
position = Vector2(-9, 5)
|
||||
target_position = Vector2(0, 13)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
113
fabigame/scenes/coin.tscn
Normal file
113
fabigame/scenes/coin.tscn
Normal file
@ -0,0 +1,113 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://cttwpovmajtsa"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://2alfmycos3hc" path="res://assets/graphics/pickups/coin.png" id="1_3uqv3"]
|
||||
[ext_resource type="Script" path="res://scripts/coin.gd" id="1_xjdrh"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_yrydk"]
|
||||
radius = 5.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_28o60"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dy7dh"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_36not"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mlbb3"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gw3cn"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(64, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mr785"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(80, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3ja4u"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(96, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hirih"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(112, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sqfn2"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(128, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0vheq"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(144, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_26js3"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(160, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j4cxo"]
|
||||
atlas = ExtResource("1_3uqv3")
|
||||
region = Rect2(176, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_porqx"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_28o60")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dy7dh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_36not")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mlbb3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gw3cn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mr785")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3ja4u")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hirih")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sqfn2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0vheq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_26js3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j4cxo")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[node name="Area2D" type="Area2D"]
|
||||
script = ExtResource("1_xjdrh")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_yrydk")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_porqx")
|
||||
autoplay = "default"
|
||||
frame_progress = 0.258061
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -1,13 +1,71 @@
|
||||
[gd_scene load_steps=28 format=3 uid="uid://djgtbc1quqvwe"]
|
||||
[gd_scene load_steps=44 format=3 uid="uid://djgtbc1quqvwe"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_ay2gi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvgh32yadcjcq" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_5mbmt"]
|
||||
[ext_resource type="Texture2D" uid="uid://385u5ioc15bk" path="res://assets/graphics/player/dead/Player Death 64x64.png" id="2_10ats"]
|
||||
[ext_resource type="Texture2D" uid="uid://1tiutqy11mhk" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_p1quv"]
|
||||
[ext_resource type="Texture2D" uid="uid://2mxlso64vnrk" path="res://assets/graphics/player/run/player run 48x48.png" id="3_2y1a6"]
|
||||
[ext_resource type="Texture2D" uid="uid://cwiun1ntuu02d" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5o14d"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_iice4"]
|
||||
radius = 6.32456
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5pxpi"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r74fh"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m7phw"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gay5g"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t22ra"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(192, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_grdn6"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(240, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xqiyd"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(288, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0cbok"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(336, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_licv2"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(384, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_p8pio"]
|
||||
atlas = ExtResource("2_10ats")
|
||||
region = Rect2(432, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2erm2"]
|
||||
atlas = ExtResource("2_p1quv")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ry778"]
|
||||
atlas = ExtResource("2_p1quv")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1xrha"]
|
||||
atlas = ExtResource("2_p1quv")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0oqh6"]
|
||||
atlas = ExtResource("2_p1quv")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1yv5c"]
|
||||
atlas = ExtResource("2_5mbmt")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
@ -96,6 +154,58 @@ region = Rect2(336, 0, 48, 48)
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5pxpi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r74fh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_m7phw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gay5g")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t22ra")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_grdn6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xqiyd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0cbok")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_licv2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_p8pio")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"Dead",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2erm2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ry778")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1xrha")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0oqh6")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"Hurt",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1yv5c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@ -200,8 +310,10 @@ position = Vector2(-6, -5)
|
||||
texture_filter = 1
|
||||
scale = Vector2(1.00239, 0.967018)
|
||||
sprite_frames = SubResource("SpriteFrames_ck70u")
|
||||
animation = &"Idle"
|
||||
animation = &"Dead"
|
||||
autoplay = "Idle"
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2(0, -30)
|
||||
|
||||
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=15 format=4 uid="uid://ciko2h5jj1a3k"]
|
||||
[gd_scene load_steps=17 format=4 uid="uid://ciko2h5jj1a3k"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://djgtbc1quqvwe" path="res://scenes/dude.tscn" id="1_4l1yw"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3da1xpx6f8do" path="res://assets/graphics/environment/background/forestbackground.png" id="1_i3nvv"]
|
||||
@ -10,6 +10,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bcwyohfx8ft18" path="res://assets/graphics/environment/background/sky_strip.png" id="2_twm8w"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmsqm0stkx5s2" path="res://assets/graphics/environment/background/clouds.png" id="3_nw1b4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5r8lr50mwhws" path="res://assets/graphics/environment/background/midgroud_grass.png" id="4_d4yqf"]
|
||||
[ext_resource type="PackedScene" uid="uid://cttwpovmajtsa" path="res://scenes/coin.tscn" id="11_v5ca1"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0pun5awvst0k" path="res://scenes/badguy.tscn" id="12_18k5f"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_bdyqk"]
|
||||
texture = ExtResource("1_yjgfx")
|
||||
@ -451,15 +453,15 @@ unique_name_in_owner = true
|
||||
script = ExtResource("1_tpgoh")
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("1_4l1yw")]
|
||||
position = Vector2(160, 90)
|
||||
position = Vector2(305, -22)
|
||||
|
||||
[node name="RigidBody2D" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
position = Vector2(92, 53)
|
||||
[node name="Box" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
position = Vector2(137, 23)
|
||||
|
||||
[node name="RigidBody2D2" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
[node name="Box2" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
position = Vector2(261, 64)
|
||||
|
||||
[node name="RigidBody2D3" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
[node name="Box3" parent="." groups=["shootable"] instance=ExtResource("1_mg5q5")]
|
||||
position = Vector2(215, 64)
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
@ -480,4 +482,36 @@ position = Vector2(0, -7.76443)
|
||||
shape = SubResource("RectangleShape2D_lbd3t")
|
||||
debug_color = Color(0.31865, 0.625237, 0, 0.42)
|
||||
|
||||
[node name="Coins" type="Node" parent="."]
|
||||
|
||||
[node name="Coin" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(69, 59)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Coin3" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(4, -4)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Coin4" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(277, -8)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Coin6" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(385, 58)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Coin5" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(246, -16)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Coin2" parent="Coins" instance=ExtResource("11_v5ca1")]
|
||||
position = Vector2(486, 25)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="BadGuys" type="Node" parent="."]
|
||||
|
||||
[node name="BadGuy" parent="BadGuys" instance=ExtResource("12_18k5f")]
|
||||
position = Vector2(359, 60)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
|
||||
|
40
fabigame/scripts/badguy.gd
Normal file
40
fabigame/scripts/badguy.gd
Normal file
@ -0,0 +1,40 @@
|
||||
class_name BadGuy extends Area2D
|
||||
|
||||
signal playerDamage
|
||||
var direction = 1
|
||||
const speed = 60
|
||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@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
|
||||
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
position.x += direction * speed * delta
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
playerDamage.emit()
|
11
fabigame/scripts/coin.gd
Normal file
11
fabigame/scripts/coin.gd
Normal file
@ -0,0 +1,11 @@
|
||||
class_name Coin extends Area2D
|
||||
|
||||
signal coinCollected
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
coinCollected.emit()
|
||||
queue_free()
|
@ -16,92 +16,119 @@ var pushTarget
|
||||
var pushLefEnabled = false
|
||||
var pushRightEnabled = false
|
||||
var isJumping = false
|
||||
|
||||
var animPlaying = "idle"
|
||||
var living = true
|
||||
|
||||
signal playerDead
|
||||
|
||||
@onready var right_target: Node2D = $RightTarget
|
||||
@onready var left_target: Node2D = $LeftTarget
|
||||
|
||||
func hurtPlayer(amt):
|
||||
print("Character knows it should be hurt")
|
||||
animPlaying = "hurt"
|
||||
playerSprite.play("Hurt")
|
||||
|
||||
func killPlayer():
|
||||
if living:
|
||||
living = false
|
||||
print("MORRIDO")
|
||||
animPlaying = "dead"
|
||||
playerSprite.play("Dead")
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
if living and not animPlaying =="hurt":
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var direction := Input.get_axis("ui_left", "ui_right")
|
||||
if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false:
|
||||
print("Shove a box")
|
||||
pushTarget.apply_central_impulse(Vector2(1,0) * PUSHFORCE * 2)
|
||||
pushRightEnabled = false
|
||||
|
||||
if Input.is_action_just_pressed("shove") && faceLeft == true && pushLefEnabled == true:
|
||||
pushTarget.apply_central_impulse(Vector2(-1,0) * PUSHFORCE * 2)
|
||||
pushLefEnabled = false
|
||||
|
||||
if Input.is_action_just_pressed("shoot"):
|
||||
print("I'm an owl: Shoot shoot")
|
||||
var myBullet = %SceneManager.bulletFactory()
|
||||
if not faceLeft:
|
||||
myBullet.transform = right_target.global_transform
|
||||
myBullet.setSpeed(750)
|
||||
if faceLeft == true:
|
||||
myBullet.transform = left_target.global_transform
|
||||
myBullet.setSpeed(-750)
|
||||
|
||||
if direction:
|
||||
velocity.x = direction * SPEED
|
||||
if direction >0:
|
||||
faceLeft = false
|
||||
if direction <0:
|
||||
faceLeft = true
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
if faceLeft:
|
||||
playerSprite.flip_h = true
|
||||
else:
|
||||
playerSprite.flip_h = false
|
||||
|
||||
if is_on_floor():
|
||||
isJumping = false
|
||||
if direction == 0:
|
||||
playerSprite.play("Idle")
|
||||
else:
|
||||
playerSprite.play("Run")
|
||||
else:
|
||||
if not isJumping:
|
||||
playerSprite.play("Jump")
|
||||
isJumping = true
|
||||
|
||||
move_and_slide()
|
||||
if right_ray.is_colliding():
|
||||
print("Something is on my right")
|
||||
if not faceLeft:
|
||||
var collider = right_ray.get_collider()
|
||||
if collider is Node:
|
||||
if collider.is_in_group("box"):
|
||||
print("This is a pushable box")
|
||||
pushTarget = collider
|
||||
pushRightEnabled = true
|
||||
else:
|
||||
pushRightEnabled = false
|
||||
|
||||
if left_ray.is_colliding():
|
||||
print("Something is on my left")
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var direction := Input.get_axis("ui_left", "ui_right")
|
||||
if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false:
|
||||
print("Shove a box")
|
||||
pushTarget.apply_central_impulse(Vector2(1,0) * PUSHFORCE * 2)
|
||||
pushRightEnabled = false
|
||||
|
||||
if Input.is_action_just_pressed("shove") && faceLeft == true && pushLefEnabled == true:
|
||||
pushTarget.apply_central_impulse(Vector2(-1,0) * PUSHFORCE * 2)
|
||||
pushLefEnabled = false
|
||||
|
||||
if Input.is_action_just_pressed("shoot"):
|
||||
print("I'm an owl: Shoot shoot")
|
||||
var myBullet = %SceneManager.bulletFactory()
|
||||
if not faceLeft:
|
||||
myBullet.transform = right_target.global_transform
|
||||
myBullet.setSpeed(750)
|
||||
if faceLeft == true:
|
||||
myBullet.transform = left_target.global_transform
|
||||
myBullet.setSpeed(-750)
|
||||
|
||||
if direction:
|
||||
velocity.x = direction * SPEED
|
||||
if direction >0:
|
||||
faceLeft = false
|
||||
if direction <0:
|
||||
faceLeft = true
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
if faceLeft:
|
||||
var collider = left_ray.get_collider()
|
||||
if collider is Node:
|
||||
if collider.is_in_group("box"):
|
||||
print("I can shove this box")
|
||||
pushTarget = collider
|
||||
pushLefEnabled = true
|
||||
else:
|
||||
pushLefEnabled = false
|
||||
|
||||
for i in get_slide_collision_count():
|
||||
var c = get_slide_collision(i)
|
||||
if c.get_collider() is RigidBody2D:
|
||||
c.get_collider().apply_central_impulse(-c.get_normal() * BUMP_FORCE)
|
||||
playerSprite.flip_h = true
|
||||
else:
|
||||
playerSprite.flip_h = false
|
||||
|
||||
if is_on_floor():
|
||||
isJumping = false
|
||||
if direction == 0:
|
||||
playerSprite.play("Idle")
|
||||
else:
|
||||
playerSprite.play("Run")
|
||||
else:
|
||||
if not isJumping:
|
||||
playerSprite.play("Jump")
|
||||
isJumping = true
|
||||
|
||||
move_and_slide()
|
||||
if right_ray.is_colliding():
|
||||
print("Something is on my right")
|
||||
if not faceLeft:
|
||||
var collider = right_ray.get_collider()
|
||||
if collider is Node:
|
||||
if collider.is_in_group("box"):
|
||||
print("This is a pushable box")
|
||||
pushTarget = collider
|
||||
pushRightEnabled = true
|
||||
else:
|
||||
pushRightEnabled = false
|
||||
|
||||
if left_ray.is_colliding():
|
||||
print("Something is on my left")
|
||||
if faceLeft:
|
||||
var collider = left_ray.get_collider()
|
||||
if collider is Node:
|
||||
if collider.is_in_group("box"):
|
||||
print("I can shove this box")
|
||||
pushTarget = collider
|
||||
pushLefEnabled = true
|
||||
else:
|
||||
pushLefEnabled = false
|
||||
|
||||
for i in get_slide_collision_count():
|
||||
var c = get_slide_collision(i)
|
||||
if c.get_collider() is RigidBody2D:
|
||||
c.get_collider().apply_central_impulse(-c.get_normal() * BUMP_FORCE)
|
||||
|
||||
|
||||
func _on_animation_finished() -> void:
|
||||
if animPlaying == "hurt":
|
||||
animPlaying ="idle"
|
||||
if animPlaying == "dead":
|
||||
### emit a custom signal
|
||||
playerDead.emit()
|
||||
|
||||
|
34
fabigame/scripts/game_controller.gd
Normal file
34
fabigame/scripts/game_controller.gd
Normal file
@ -0,0 +1,34 @@
|
||||
extends Node
|
||||
|
||||
var coinsCollected:int = 0
|
||||
var player:Resource
|
||||
|
||||
signal playerHurt()
|
||||
signal playerDeath()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
player = load("res://scripts/res/dudestats.tres")
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func coinCollected():
|
||||
coinsCollected +=1
|
||||
print("Total coins collected "+str(coinsCollected) )
|
||||
|
||||
func playerDamage():
|
||||
if player.health > 0:
|
||||
player.health -= 20
|
||||
if player.health <=0:
|
||||
##kill him
|
||||
playerDeath.emit()
|
||||
else:
|
||||
##damage him
|
||||
playerHurt.emit(20)
|
||||
func reset():
|
||||
player.health = player.max_health
|
||||
coinsCollected = 0
|
||||
|
6
fabigame/scripts/res/characterstats.gd
Normal file
6
fabigame/scripts/res/characterstats.gd
Normal file
@ -0,0 +1,6 @@
|
||||
class_name CharacterStats extends Resource
|
||||
|
||||
|
||||
@export var max_health:int = 100
|
||||
@export var starting_heatlh: int = 100
|
||||
@export var health: int = 100
|
9
fabigame/scripts/res/dudestats.tres
Normal file
9
fabigame/scripts/res/dudestats.tres
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://bo060uupgs5s0"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/res/characterstats.gd" id="1_8xb6q"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_8xb6q")
|
||||
max_health = 100
|
||||
starting_heatlh = 100
|
||||
health = 100
|
9
fabigame/scripts/res/enemystats.tres
Normal file
9
fabigame/scripts/res/enemystats.tres
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://dqihgguptx2it"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/res/characterstats.gd" id="1_qhki2"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_qhki2")
|
||||
max_health = 50
|
||||
starting_heatlh = 50
|
||||
health = 50
|
@ -3,9 +3,32 @@ extends Node
|
||||
var bulletsFiredTotal := 0
|
||||
var bulletsMadeTotal := 0
|
||||
var bulletArray:Array = []
|
||||
@onready var coins: Node = $"../Coins"
|
||||
@onready var bad_guys: Node = $"../BadGuys"
|
||||
|
||||
@onready var player: CharacterBody2D = $"../CharacterBody2D"
|
||||
|
||||
|
||||
|
||||
var bullet = preload("res://scenes/bullet.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
### coins loop
|
||||
for n in coins.get_children():
|
||||
print("coin found")
|
||||
n.coinCollected.connect(GameController.coinCollected)
|
||||
### enemies loop
|
||||
for n in bad_guys.get_children():
|
||||
print("enemy found")
|
||||
n.playerDamage.connect(GameController.playerDamage)
|
||||
|
||||
### wire up GameController signals to Player
|
||||
GameController.playerHurt.connect(hurtPlayer)
|
||||
GameController.playerDeath.connect(killPlayer)
|
||||
|
||||
player.playerDead.connect(deadPlayer)
|
||||
|
||||
|
||||
func bulletFactory():
|
||||
print("Make a bullet at the factory")
|
||||
var mybullet
|
||||
@ -21,11 +44,21 @@ func bulletFactory():
|
||||
bulletArray.push_front(mybullet)
|
||||
bulletsMadeTotal += 1
|
||||
return mybullet
|
||||
|
||||
|
||||
func onBulletHit(bullet, body):
|
||||
print("Scene Manager knows a bullet hit something")
|
||||
bullet.setSpeed(0)
|
||||
if body.is_in_group("shootable"):
|
||||
print("RIP")
|
||||
body.queue_free()
|
||||
|
||||
|
||||
func hurtPlayer(amt):
|
||||
player.hurtPlayer(amt)
|
||||
|
||||
func killPlayer():
|
||||
player.killPlayer()
|
||||
|
||||
func deadPlayer():
|
||||
GameController.reset()
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user