enemies, gamecontroller, playerdeath, coins
This commit is contained in:
parent
0df4295b7c
commit
a5f092f125
BIN
novembergame/assets/graphics/enemies/slime_green.png
Normal file
BIN
novembergame/assets/graphics/enemies/slime_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 908 B |
34
novembergame/assets/graphics/enemies/slime_green.png.import
Normal file
34
novembergame/assets/graphics/enemies/slime_green.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://da7ap0kxh23js"
|
||||||
|
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
novembergame/assets/graphics/pickups/coin.png
Normal file
BIN
novembergame/assets/graphics/pickups/coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 B |
34
novembergame/assets/graphics/pickups/coin.png.import
Normal file
34
novembergame/assets/graphics/pickups/coin.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dexybjngcxs3g"
|
||||||
|
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
novembergame/assets/graphics/player/death/Player Death 64x64.png
Normal file
BIN
novembergame/assets/graphics/player/death/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://1h4aupwklktd"
|
||||||
|
path="res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/graphics/player/death/Player Death 64x64.png"
|
||||||
|
dest_files=["res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/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
novembergame/assets/graphics/player/hurt/Player Hurt 48x48.png
Normal file
BIN
novembergame/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://chrp31s6hw6fp"
|
||||||
|
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/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
GameController="*res://scripts/game_controller.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=320
|
window/size/viewport_width=320
|
||||||
|
74
novembergame/scenes/badguy.tscn
Normal file
74
novembergame/scenes/badguy.tscn
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://do41rhebtm7vw"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/badguy.gd" id="1_3gg16"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://da7ap0kxh23js" path="res://assets/graphics/enemies/slime_green.png" id="1_oxuep"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wxa5t"]
|
||||||
|
atlas = ExtResource("1_oxuep")
|
||||||
|
region = Rect2(0, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_et71u"]
|
||||||
|
atlas = ExtResource("1_oxuep")
|
||||||
|
region = Rect2(24, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ms1qp"]
|
||||||
|
atlas = ExtResource("1_oxuep")
|
||||||
|
region = Rect2(48, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_cui8n"]
|
||||||
|
atlas = ExtResource("1_oxuep")
|
||||||
|
region = Rect2(72, 24, 24, 24)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_0d1bt"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_wxa5t")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_et71u")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ms1qp")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_cui8n")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yg3ku"]
|
||||||
|
size = Vector2(16.6667, 20)
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D"]
|
||||||
|
script = ExtResource("1_3gg16")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
sprite_frames = SubResource("SpriteFrames_0d1bt")
|
||||||
|
animation = &"idle"
|
||||||
|
autoplay = "idle"
|
||||||
|
frame_progress = 0.711712
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0, 4)
|
||||||
|
scale = Vector2(0.840001, 0.8)
|
||||||
|
shape = SubResource("RectangleShape2D_yg3ku")
|
||||||
|
|
||||||
|
[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, 9)
|
||||||
|
|
||||||
|
[node name="CastFloorLeft" type="RayCast2D" parent="."]
|
||||||
|
position = Vector2(-9, 5)
|
||||||
|
target_position = Vector2(0, 10)
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -1,13 +1,71 @@
|
|||||||
[gd_scene load_steps=28 format=3 uid="uid://cjqhmd3158nb7"]
|
[gd_scene load_steps=44 format=3 uid="uid://cjqhmd3158nb7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_u27sl"]
|
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_u27sl"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://1h4aupwklktd" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_puyd6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cjuaglcx1l8mq" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_s31uh"]
|
[ext_resource type="Texture2D" uid="uid://cjuaglcx1l8mq" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_s31uh"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://chrp31s6hw6fp" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_t63lx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b82ecqnclroum" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5pc3d"]
|
[ext_resource type="Texture2D" uid="uid://b82ecqnclroum" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_5pc3d"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bddwju2m8xvbj" path="res://assets/graphics/player/run/player run 48x48.png" id="3_pvg6g"]
|
[ext_resource type="Texture2D" uid="uid://bddwju2m8xvbj" path="res://assets/graphics/player/run/player run 48x48.png" id="3_pvg6g"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pg3nc"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_pg3nc"]
|
||||||
radius = 18.1108
|
radius = 18.1108
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lewcv"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7vgrw"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ax0dy"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_h3um1"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xpfml"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_crvik"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_l42x7"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ux8dt"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7w8ul"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(384, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_js8u6"]
|
||||||
|
atlas = ExtResource("2_puyd6")
|
||||||
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_li3qm"]
|
||||||
|
atlas = ExtResource("2_t63lx")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_h1vht"]
|
||||||
|
atlas = ExtResource("2_t63lx")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hrho2"]
|
||||||
|
atlas = ExtResource("2_t63lx")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ur1h8"]
|
||||||
|
atlas = ExtResource("2_t63lx")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mirx3"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mirx3"]
|
||||||
atlas = ExtResource("2_s31uh")
|
atlas = ExtResource("2_s31uh")
|
||||||
region = Rect2(0, 0, 48, 48)
|
region = Rect2(0, 0, 48, 48)
|
||||||
@ -96,6 +154,58 @@ region = Rect2(336, 0, 48, 48)
|
|||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lewcv")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7vgrw")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ax0dy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_h3um1")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_xpfml")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_crvik")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_l42x7")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ux8dt")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7w8ul")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_js8u6")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"death",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_li3qm")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_h1vht")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_hrho2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ur1h8")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"hurt",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_mirx3")
|
"texture": SubResource("AtlasTexture_mirx3")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@ -198,9 +308,13 @@ position = Vector2(-18, -5)
|
|||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
sprite_frames = SubResource("SpriteFrames_p5ykk")
|
sprite_frames = SubResource("SpriteFrames_p5ykk")
|
||||||
animation = &"idle"
|
animation = &"death"
|
||||||
autoplay = "run"
|
autoplay = "run"
|
||||||
|
frame = 9
|
||||||
|
frame_progress = 1.0
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
position = Vector2(-1, 0)
|
position = Vector2(-1, 0)
|
||||||
offset = Vector2(0, -40)
|
offset = Vector2(0, -40)
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
|
||||||
|
112
novembergame/scenes/coin.tscn
Normal file
112
novembergame/scenes/coin.tscn
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
[gd_scene load_steps=17 format=3 uid="uid://0e20afji7t11"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/coin.gd" id="1_7lr2g"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dexybjngcxs3g" path="res://assets/graphics/pickups/coin.png" id="1_o2b12"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_5x4sn"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_1h4vi"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_eeq2t"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_be0hj"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(32, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tlsoj"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(48, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_f0lcn"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(64, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7f8i4"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(80, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_myst1"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(96, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rwemh"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(112, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8djgs"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(128, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ldsox"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(144, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4ljys"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(160, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mq67e"]
|
||||||
|
atlas = ExtResource("1_o2b12")
|
||||||
|
region = Rect2(176, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_eujox"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_1h4vi")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_eeq2t")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_be0hj")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_tlsoj")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_f0lcn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7f8i4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_myst1")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rwemh")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_8djgs")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ldsox")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_4ljys")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_mq67e")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D"]
|
||||||
|
script = ExtResource("1_7lr2g")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
scale = Vector2(0.48, 0.520001)
|
||||||
|
shape = SubResource("CircleShape2D_5x4sn")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
sprite_frames = SubResource("SpriteFrames_eujox")
|
||||||
|
autoplay = "default"
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=14 format=4 uid="uid://cmh68gsfunmwa"]
|
[gd_scene load_steps=16 format=4 uid="uid://cmh68gsfunmwa"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://vwe7rit3r0ho" path="res://assets/graphics/environment/background/forestbackground.png" id="1_6g8gi"]
|
[ext_resource type="Texture2D" uid="uid://vwe7rit3r0ho" path="res://assets/graphics/environment/background/forestbackground.png" id="1_6g8gi"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bvbxh8nxgekny" path="res://assets/graphics/environment/terrain/Terrain (32x32).png" id="1_n0y6d"]
|
[ext_resource type="Texture2D" uid="uid://bvbxh8nxgekny" path="res://assets/graphics/environment/terrain/Terrain (32x32).png" id="1_n0y6d"]
|
||||||
@ -8,6 +8,8 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://ceoscwflxdsej" path="res://assets/graphics/environment/background/midground.png" id="2_nbj6c"]
|
[ext_resource type="Texture2D" uid="uid://ceoscwflxdsej" path="res://assets/graphics/environment/background/midground.png" id="2_nbj6c"]
|
||||||
[ext_resource type="Script" path="res://scripts/trigger.gd" id="2_tsnf5"]
|
[ext_resource type="Script" path="res://scripts/trigger.gd" id="2_tsnf5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dm71h7adhhf8u" path="res://scenes/box.tscn" id="3_pi0u1"]
|
[ext_resource type="PackedScene" uid="uid://dm71h7adhhf8u" path="res://scenes/box.tscn" id="3_pi0u1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://0e20afji7t11" path="res://scenes/coin.tscn" id="9_6tlsy"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://do41rhebtm7vw" path="res://scenes/badguy.tscn" id="10_rpj3s"]
|
||||||
|
|
||||||
[sub_resource type="TileMapPattern" id="TileMapPattern_mkieg"]
|
[sub_resource type="TileMapPattern" id="TileMapPattern_mkieg"]
|
||||||
tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 1, 196608, 262144, 2)
|
tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 1, 196608, 262144, 2)
|
||||||
@ -404,7 +406,7 @@ position = Vector2(160, 90)
|
|||||||
texture = ExtResource("2_nbj6c")
|
texture = ExtResource("2_nbj6c")
|
||||||
|
|
||||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||||
tile_map_data = PackedByteArray("AAAAAAUAAAAAAAQAAAABAAUAAAABAAQAAAACAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAFAAUAAAABAAQAAAAGAAUAAAABAAQAAAAHAAUAAAABAAQAAAAIAAUAAAABAAQAAAAJAAUAAAABAAQAAAAKAAUAAAABAAQAAAALAAUAAAABAAQAAAAMAAUAAAABAAQAAAANAAUAAAABAAQAAAAOAAUAAAABAAQAAAAPAAUAAAABAAQAAAAQAAUAAAABAAQAAAARAAUAAAABAAQAAAASAAUAAAABAAQAAAATAAUAAAABAAQAAAAUAAUAAAABAAQAAAAVAAUAAAACAAQAAAAGAAMAAAAEAAQAAAAIAAIAAAAEAAQAAAAAAAMAAAAEAAIAAAAAAAIAAAAEAAEAAAAAAAEAAAAEAAAAAAALAAIAAAAAAAAAAAAMAAIAAAABAAAAAAANAAIAAAABAAAAAAAOAAIAAAACAAAAAAAOAAMAAAACAAIAAAANAAMAAAABAAIAAAAMAAMAAAABAAIAAAALAAMAAAAAAAIAAAAKAAAAAAAAAAQAAAALAAAAAAABAAQAAAAMAAAAAAAQAAQAAAAMAP//AAAEAAAAAAAOAP7/AAAEAAQAAAA=")
|
tile_map_data = PackedByteArray("AAAAAAUAAAAAAAQAAAABAAUAAAABAAQAAAACAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAFAAUAAAABAAQAAAAGAAUAAAABAAQAAAAHAAUAAAABAAQAAAAIAAUAAAABAAQAAAAJAAUAAAABAAQAAAAKAAUAAAABAAQAAAALAAUAAAABAAQAAAAMAAUAAAABAAQAAAANAAUAAAABAAQAAAAOAAUAAAABAAQAAAAPAAUAAAABAAQAAAAQAAUAAAABAAQAAAARAAUAAAABAAQAAAASAAUAAAABAAQAAAATAAUAAAABAAQAAAAUAAUAAAABAAQAAAAVAAUAAAACAAQAAAAGAAMAAAAEAAQAAAAIAAIAAAAEAAQAAAAAAAMAAAAEAAIAAAAAAAIAAAAEAAEAAAAAAAEAAAAEAAAAAAALAAIAAAAAAAAAAAAMAAIAAAABAAAAAAANAAIAAAABAAAAAAAOAAIAAAAHAAQAAAAOAAMAAAACAAIAAAANAAMAAAABAAIAAAAMAAMAAAABAAIAAAALAAMAAAAAAAIAAAAKAAAAAAAAAAQAAAALAAAAAAABAAQAAAAMAAAAAAAQAAQAAAAMAP//AAAEAAAAAAAOAP7/AAAEAAQAAAAOAAEAAAAEAAAAAAA=")
|
||||||
tile_set = SubResource("TileSet_wyq3g")
|
tile_set = SubResource("TileSet_wyq3g")
|
||||||
|
|
||||||
[node name="SceneManager" type="Node" parent="."]
|
[node name="SceneManager" type="Node" parent="."]
|
||||||
@ -441,14 +443,21 @@ metadata/_edit_group_ = true
|
|||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
shape = SubResource("WorldBoundaryShape2D_c5gsu")
|
shape = SubResource("WorldBoundaryShape2D_c5gsu")
|
||||||
|
|
||||||
[node name="Parallax2D" type="Parallax2D" parent="."]
|
[node name="coins" type="Node" parent="."]
|
||||||
scroll_scale = Vector2(2, 1)
|
|
||||||
repeat_size = Vector2(320, 0)
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Parallax2D"]
|
[node name="Coin" parent="coins" instance=ExtResource("9_6tlsy")]
|
||||||
texture_filter = 1
|
position = Vector2(208, 90)
|
||||||
position = Vector2(160, 150)
|
|
||||||
scale = Vector2(1, 0.3)
|
[node name="Coin2" parent="coins" instance=ExtResource("9_6tlsy")]
|
||||||
texture = ExtResource("2_nbj6c")
|
position = Vector2(273, 58)
|
||||||
|
|
||||||
|
[node name="Coin3" parent="coins" instance=ExtResource("9_6tlsy")]
|
||||||
|
position = Vector2(422, 58)
|
||||||
|
|
||||||
|
[node name="enemies" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Area2D2" parent="enemies" instance=ExtResource("10_rpj3s")]
|
||||||
|
position = Vector2(386, 51)
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
|
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
|
||||||
|
39
novembergame/scripts/badguy.gd
Normal file
39
novembergame/scripts/badguy.gd
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
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()
|
12
novembergame/scripts/coin.gd
Normal file
12
novembergame/scripts/coin.gd
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class_name Coin extends Area2D
|
||||||
|
|
||||||
|
signal coinCollected
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
if body.is_in_group("player"):
|
||||||
|
coinCollected.emit()
|
||||||
|
queue_free()
|
||||||
|
|
@ -17,11 +17,27 @@ var pushLeftEnabled = false
|
|||||||
var pushRightEnabled = false
|
var pushRightEnabled = false
|
||||||
var isJumping = false
|
var isJumping = false
|
||||||
|
|
||||||
|
var animPlaying = "idle"
|
||||||
|
var living = true
|
||||||
|
|
||||||
|
signal playerDead
|
||||||
|
|
||||||
@onready var right_target: Node2D = $RightTarget
|
@onready var right_target: Node2D = $RightTarget
|
||||||
@onready var left_target: Node2D = $LeftTarget
|
@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
|
||||||
|
animPlaying = "death"
|
||||||
|
playerSprite.play(animPlaying)
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
if living and not animPlaying =="hurt":
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
velocity += get_gravity() * delta
|
velocity += get_gravity() * delta
|
||||||
@ -107,3 +123,11 @@ func _physics_process(delta: float) -> void:
|
|||||||
var c = get_slide_collision(i)
|
var c = get_slide_collision(i)
|
||||||
if c.get_collider() is RigidBody2D:
|
if c.get_collider() is RigidBody2D:
|
||||||
c.get_collider().apply_central_impulse(-c.get_normal() * BUMPFORCE)
|
c.get_collider().apply_central_impulse(-c.get_normal() * BUMPFORCE)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animation_finished() -> void:
|
||||||
|
if animPlaying == "hurt":
|
||||||
|
animPlaying ="idle"
|
||||||
|
if animPlaying=="death":
|
||||||
|
## emit a custom signal
|
||||||
|
playerDead.emit()
|
||||||
|
34
novembergame/scripts/game_controller.gd
Normal file
34
novembergame/scripts/game_controller.gd
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var coinsCollected:int = 0
|
||||||
|
var player:Resource
|
||||||
|
|
||||||
|
signal playerHurt(amt)
|
||||||
|
signal playerDeath()
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
player = load("res://scripts/res/playerstats.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
novembergame/scripts/res/characterstats.gd
Normal file
6
novembergame/scripts/res/characterstats.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class_name CharacterStats extends Resource
|
||||||
|
|
||||||
|
|
||||||
|
@export var max_health:int = 100
|
||||||
|
@export var starting_health: int = 100
|
||||||
|
@export var health: int = 100
|
9
novembergame/scripts/res/enemystats.tres
Normal file
9
novembergame/scripts/res/enemystats.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://dlllgnb2qyb2p"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/res/characterstats.gd" id="1_yv8hh"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_yv8hh")
|
||||||
|
max_health = 50
|
||||||
|
starting_health = 50
|
||||||
|
health = 50
|
9
novembergame/scripts/res/playerstats.tres
Normal file
9
novembergame/scripts/res/playerstats.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://bqbgmfbankxvw"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/res/characterstats.gd" id="1_8phuw"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_8phuw")
|
||||||
|
max_health = 100
|
||||||
|
starting_health = 100
|
||||||
|
health = 100
|
@ -3,9 +3,29 @@ extends Node
|
|||||||
var bulletsFiredTotal :=0
|
var bulletsFiredTotal :=0
|
||||||
var bulletsMadeTotal :=0
|
var bulletsMadeTotal :=0
|
||||||
var bulletArray:Array = []
|
var bulletArray:Array = []
|
||||||
|
@onready var coins: Node = $"../coins"
|
||||||
|
@onready var enemies: Node = $"../enemies"
|
||||||
|
|
||||||
|
@onready var player: CharacterBody2D = $"../CharacterBody2D"
|
||||||
|
|
||||||
var bullet = preload("res://scenes/bullet.tscn")
|
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 enemies.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():
|
func bulletFactory():
|
||||||
print("Make a bullet at the factory")
|
print("Make a bullet at the factory")
|
||||||
var mybullet
|
var mybullet
|
||||||
@ -28,3 +48,14 @@ func onBulletHit(bullet, body):
|
|||||||
if body.is_in_group("shootable"):
|
if body.is_in_group("shootable"):
|
||||||
print("explode this thing")
|
print("explode this thing")
|
||||||
body.queue_free()
|
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