week 5
This commit is contained in:
parent
f8cfa904d9
commit
42eb81d7d4
BIN
augustgamecourse/assets/graphics/enemies/slime_purple.png
Normal file
BIN
augustgamecourse/assets/graphics/enemies/slime_purple.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://oko77j3h5pvi"
|
||||
path="res://.godot/imported/slime_purple.png-7c7bd1452ab1f0d8805110e20459acf6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/enemies/slime_purple.png"
|
||||
dest_files=["res://.godot/imported/slime_purple.png-7c7bd1452ab1f0d8805110e20459acf6.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
augustgamecourse/assets/graphics/pickups/coin.png
Normal file
BIN
augustgamecourse/assets/graphics/pickups/coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 B |
34
augustgamecourse/assets/graphics/pickups/coin.png.import
Normal file
34
augustgamecourse/assets/graphics/pickups/coin.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ciplly2mh0byk"
|
||||
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
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d6d3re6epsh4"
|
||||
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
|
@ -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
|
||||
|
74
augustgamecourse/scenes/badguy.tscn
Normal file
74
augustgamecourse/scenes/badguy.tscn
Normal file
@ -0,0 +1,74 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://chg3b7bwi8e5v"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://oko77j3h5pvi" path="res://assets/graphics/enemies/slime_purple.png" id="1_gtd16"]
|
||||
[ext_resource type="Script" path="res://scripts/badguy.gd" id="1_oosn7"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xartt"]
|
||||
atlas = ExtResource("1_gtd16")
|
||||
region = Rect2(0, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_locj4"]
|
||||
atlas = ExtResource("1_gtd16")
|
||||
region = Rect2(24, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nwfhl"]
|
||||
atlas = ExtResource("1_gtd16")
|
||||
region = Rect2(48, 24, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qh0so"]
|
||||
atlas = ExtResource("1_gtd16")
|
||||
region = Rect2(72, 24, 24, 24)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_8s2ow"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xartt")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_locj4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nwfhl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qh0so")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fflir"]
|
||||
size = Vector2(16, 15)
|
||||
|
||||
[node name="Area2D" type="Area2D"]
|
||||
script = ExtResource("1_oosn7")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_8s2ow")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
frame = 2
|
||||
frame_progress = 0.361157
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 4.5)
|
||||
shape = SubResource("RectangleShape2D_fflir")
|
||||
|
||||
[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, 1)
|
||||
target_position = Vector2(0, 14)
|
||||
|
||||
[node name="CastFloorLeft" type="RayCast2D" parent="."]
|
||||
position = Vector2(-9, 0)
|
||||
target_position = Vector2(0, 15)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
114
augustgamecourse/scenes/coin.tscn
Normal file
114
augustgamecourse/scenes/coin.tscn
Normal file
@ -0,0 +1,114 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://dkqrujmfd1dt4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ciplly2mh0byk" path="res://assets/graphics/pickups/coin.png" id="1_uj4yu"]
|
||||
[ext_resource type="Script" path="res://scripts/coin.gd" id="1_wmh33"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lu172"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_simim"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g3q2r"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8hquj"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gjx14"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(64, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lmkif"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(80, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r3lrs"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(96, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ltulh"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(112, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4op8d"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(128, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tmcc6"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(144, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_h6sll"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(160, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4qxb4"]
|
||||
atlas = ExtResource("1_uj4yu")
|
||||
region = Rect2(176, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_l8kad"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lu172")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_simim")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g3q2r")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8hquj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gjx14")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lmkif")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r3lrs")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ltulh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4op8d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tmcc6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_h6sll")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4qxb4")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jntnx"]
|
||||
radius = 5.0
|
||||
|
||||
[node name="Area2D" type="Area2D"]
|
||||
script = ExtResource("1_wmh33")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_l8kad")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.516236
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_jntnx")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=13 format=4 uid="uid://diss5ty7548p3"]
|
||||
[gd_scene load_steps=15 format=4 uid="uid://diss5ty7548p3"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cjdayl6k7xt2s" path="res://assets/graphics/environment/background/forestbackground.png" id="1_7cw2b"]
|
||||
[ext_resource type="PackedScene" uid="uid://0j0320rcnxo7" path="res://scenes/crate.tscn" id="1_8ekmb"]
|
||||
@ -8,6 +8,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dj70wmrhdo67v" path="res://assets/graphics/environment/Terrain (32x32).png" id="2_o4xfa"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0jqrund127ta" path="res://assets/graphics/environment/background/forestmidground.png" id="2_o31nh"]
|
||||
[ext_resource type="PackedScene" uid="uid://csewven6s5npw" path="res://scenes/trigger.tscn" id="3_t3xge"]
|
||||
[ext_resource type="PackedScene" uid="uid://dkqrujmfd1dt4" path="res://scenes/coin.tscn" id="3_xdwxn"]
|
||||
[ext_resource type="PackedScene" uid="uid://chg3b7bwi8e5v" path="res://scenes/badguy.tscn" id="10_wtwdm"]
|
||||
|
||||
[sub_resource type="TileMapPattern" id="TileMapPattern_pcobp"]
|
||||
tile_data = PackedInt32Array(0, 0, 4, 1, 65536, 4, 2, 65536, 4, 3, 131072, 4)
|
||||
@ -389,6 +391,7 @@ pattern_0 = SubResource("TileMapPattern_pcobp")
|
||||
|
||||
[node name="Background" type="Parallax2D" parent="."]
|
||||
scroll_scale = Vector2(0.5, 0.5)
|
||||
scroll_offset = Vector2(4, -3)
|
||||
repeat_size = Vector2(320, 0)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
@ -413,8 +416,10 @@ texture = ExtResource("2_o31nh")
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("1_mpwqj")
|
||||
|
||||
[node name="Timer" type="Timer" parent="SceneManager"]
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
tile_map_data = PackedByteArray("AAACAAUAAAAAAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAFAAUAAAABAAQAAAAHAAQAAAAAAAIAAAAIAAQAAAABAAIAAAAJAAQAAAACAAIAAAAJAAMAAAACAAAAAAAIAAMAAAABAAAAAAAHAAMAAAAAAAAAAAAIAAAAAAAEAAQAAAALAAIAAAAAAAQAAAAMAAIAAAAQAAQAAAAMAAEAAAAPAAMAAAANAAEAAAACAAQAAAAMAAUAAAAAAAQAAAANAAUAAAABAAQAAAAOAAUAAAABAAQAAAAPAAUAAAACAAQAAAAGAAUAAAACAAQAAAA=")
|
||||
tile_map_data = PackedByteArray("AAACAAUAAAAPAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAAFAAUAAAABAAQAAAAHAAQAAAAAAAIAAAAIAAQAAAABAAIAAAAJAAQAAAACAAIAAAAJAAMAAAACAAAAAAAIAAMAAAABAAAAAAAHAAMAAAAAAAAAAAAIAAAAAAAEAAQAAAALAAIAAAAAAAQAAAAMAAIAAAAQAAQAAAAMAAEAAAAPAAMAAAANAAEAAAACAAQAAAAMAAUAAAAAAAQAAAANAAUAAAABAAQAAAAOAAUAAAABAAQAAAAPAAUAAAACAAQAAAAGAAUAAAACAAQAAAAQAAMAAAAAAAQAAAARAAMAAAABAAQAAAASAAMAAAACAAQAAAAUAAMAAAAEAAIAAAAUAAIAAAAPAAMAAAAVAAIAAAAMAAQAAAAWAAIAAAACAAIAAAAWAAEAAAACAAAAAAAVAAEAAAAPAAMAAAAUAAYAAAAAAAQAAAAVAAYAAAABAAQAAAAWAAYAAAACAAQAAAACAAQAAAAEAAAAAAA=")
|
||||
tile_set = SubResource("TileSet_cs2mx")
|
||||
|
||||
[node name="Floor" type="StaticBody2D" parent="."]
|
||||
@ -440,8 +445,29 @@ position = Vector2(117, 58)
|
||||
position = Vector2(161, -3)
|
||||
|
||||
[node name="RigidBody2D2" parent="." groups=["pushables"] instance=ExtResource("1_8ekmb")]
|
||||
position = Vector2(230, 62)
|
||||
position = Vector2(273, -14)
|
||||
|
||||
[node name="BoxTrapTarget" type="Node2D" parent="."]
|
||||
position = Vector2(205, 37)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="coins" type="Node" parent="."]
|
||||
|
||||
[node name="Coin" parent="coins" instance=ExtResource("3_xdwxn")]
|
||||
position = Vector2(206, 151)
|
||||
|
||||
[node name="Coin2" parent="coins" instance=ExtResource("3_xdwxn")]
|
||||
position = Vector2(263, 89)
|
||||
|
||||
[node name="Coin3" parent="coins" instance=ExtResource("3_xdwxn")]
|
||||
position = Vector2(368, 57)
|
||||
|
||||
[node name="enemies" type="Node" parent="."]
|
||||
|
||||
[node name="slime" parent="enemies" instance=ExtResource("10_wtwdm")]
|
||||
position = Vector2(282, 84)
|
||||
|
||||
[node name="slime2" parent="enemies" instance=ExtResource("10_wtwdm")]
|
||||
position = Vector2(106, 149)
|
||||
|
||||
[connection signal="timeout" from="SceneManager/Timer" to="SceneManager" method="resetWorld"]
|
||||
|
@ -1,10 +1,51 @@
|
||||
[gd_scene load_steps=28 format=3 uid="uid://dbgc24hrbtvxm"]
|
||||
[gd_scene load_steps=39 format=3 uid="uid://dbgc24hrbtvxm"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player.gd" id="1_5qpif"]
|
||||
[ext_resource type="Texture2D" uid="uid://d6d3re6epsh4" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_t1yra"]
|
||||
[ext_resource type="Texture2D" uid="uid://pdvgf3y1lquv" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_vcmr0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvh48exhs1ir1" path="res://assets/graphics/player/run/player run 48x48.png" id="3_a03rx"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0kfe5ms2vjbr" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_mvdmt"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uru55"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f8t0f"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gsumc"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5v4jf"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ivq41"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(192, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tw2ob"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(240, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g8lv8"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(288, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_c26el"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(336, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_11ko7"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(384, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_15v0y"]
|
||||
atlas = ExtResource("2_t1yra")
|
||||
region = Rect2(432, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_etdvv"]
|
||||
atlas = ExtResource("2_vcmr0")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
@ -93,6 +134,41 @@ region = Rect2(336, 0, 48, 48)
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uru55")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f8t0f")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gsumc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5v4jf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ivq41")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tw2ob")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g8lv8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_c26el")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_11ko7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_15v0y")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"death",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_etdvv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@ -180,7 +256,7 @@ metadata/_edit_group_ = true
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -7)
|
||||
sprite_frames = SubResource("SpriteFrames_wlxdo")
|
||||
animation = &"jump"
|
||||
animation = &"death"
|
||||
autoplay = "idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
38
augustgamecourse/scripts/badguy.gd
Normal file
38
augustgamecourse/scripts/badguy.gd
Normal file
@ -0,0 +1,38 @@
|
||||
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
|
||||
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()
|
18
augustgamecourse/scripts/coin.gd
Normal file
18
augustgamecourse/scripts/coin.gd
Normal file
@ -0,0 +1,18 @@
|
||||
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()
|
27
augustgamecourse/scripts/game_controller.gd
Normal file
27
augustgamecourse/scripts/game_controller.gd
Normal file
@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
var coinsCollected:int = 0
|
||||
var player:Resource
|
||||
|
||||
signal playerDeath
|
||||
|
||||
func _ready() -> void:
|
||||
print("Game controller is ready")
|
||||
player = load("res://scripts/resources/player.tres")
|
||||
|
||||
|
||||
func coinCollected():
|
||||
coinsCollected +=1
|
||||
print("Game Controller Coin Collected : "+str(coinsCollected))
|
||||
|
||||
func resetPlayer():
|
||||
player.health = player.max_health
|
||||
|
||||
func playerDamage():
|
||||
player.health -= 20
|
||||
print("Player health is : "+str(player.health) )
|
||||
#is the player dead?
|
||||
if player.health <= 0:
|
||||
#kill him
|
||||
playerDeath.emit()
|
||||
|
@ -19,6 +19,10 @@ var pushTarget
|
||||
|
||||
var bullet = preload("res://scenes/bullet.tscn")
|
||||
|
||||
func killPlayer():
|
||||
print("kill the player")
|
||||
#play death animation
|
||||
playerSprite.play("death")
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
|
5
augustgamecourse/scripts/resources/character_stats.gd
Normal file
5
augustgamecourse/scripts/resources/character_stats.gd
Normal file
@ -0,0 +1,5 @@
|
||||
class_name CharacterStats extends Resource
|
||||
|
||||
@export var max_health:int = 100
|
||||
@export var starting_health: int = 100
|
||||
@export var health: int = 100
|
9
augustgamecourse/scripts/resources/player.tres
Normal file
9
augustgamecourse/scripts/resources/player.tres
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://koxvwi31cjtf"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_mwxs7"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_mwxs7")
|
||||
max_health = 100
|
||||
starting_health = 100
|
||||
health = 100
|
9
augustgamecourse/scripts/resources/slime.tres
Normal file
9
augustgamecourse/scripts/resources/slime.tres
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://edb4xjspowwc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_6yxqy"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_6yxqy")
|
||||
max_health = 50
|
||||
starting_health = 50
|
||||
health = 50
|
@ -5,6 +5,10 @@ var bulletPool:Array = []
|
||||
# crate stuff
|
||||
var cratePool:Array = []
|
||||
@onready var box_trap_target: Node2D = $"../BoxTrapTarget"
|
||||
@onready var coins: Node = $"../coins"
|
||||
@onready var enemies: Node = $"../enemies"
|
||||
@onready var player: CharacterBody2D = $"../CharacterBody2D"
|
||||
@onready var timer: Timer = $Timer
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@ -13,6 +17,17 @@ func _ready() -> void:
|
||||
if obj.is_in_group("pushables"):
|
||||
cratePool.push_back(obj)
|
||||
print("Total crates on screen : "+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.playerDamage)
|
||||
#GameController signals
|
||||
GameController.playerDeath.connect(killPlayer)
|
||||
|
||||
func boxTrap():
|
||||
print("Trigger a box trap!")
|
||||
@ -47,3 +62,13 @@ func crateFactory():
|
||||
var myCrate = crate.instantiate()
|
||||
myCrate.add_to_group("pushables")
|
||||
return myCrate
|
||||
|
||||
func killPlayer():
|
||||
print("kill the player now")
|
||||
player.killPlayer()
|
||||
timer.start(3)
|
||||
|
||||
|
||||
func resetWorld():
|
||||
GameController.resetPlayer()
|
||||
get_tree().reload_current_scene()
|
||||
|
Loading…
Reference in New Issue
Block a user