Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d19d25a75 | ||
|
|
df3ebe62d2 |
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dyus25iplw8ei"
|
||||
path="res://.godot/imported/Player Idle 48x48.png-9f43f14976963a2821a06ddf8579a76a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/idle/Player Idle 48x48.png"
|
||||
dest_files=["res://.godot/imported/Player Idle 48x48.png-9f43f14976963a2821a06ddf8579a76a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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: 1021 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bihghvekq435s"
|
||||
path="res://.godot/imported/player jump 48x48.png-bb6ba8ccf76c9bd3765199af95f48c3c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/jump_fall/player jump 48x48.png"
|
||||
dest_files=["res://.godot/imported/player jump 48x48.png-bb6ba8ccf76c9bd3765199af95f48c3c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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: 3.1 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://3c7ngirfyrkh"
|
||||
path="res://.godot/imported/player run 48x48.png-3529730a2a1b5884902527ab512e774d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/player/running/player run 48x48.png"
|
||||
dest_files=["res://.godot/imported/player run 48x48.png-3529730a2a1b5884902527ab512e774d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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,14 @@ run/main_scene="uid://cqk2rgy3m1chs"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=320
|
||||
window/size/viewport_height=180
|
||||
window/size/window_width_override=960
|
||||
window/size/window_height_override=540
|
||||
window/stretch/mode="viewport"
|
||||
|
||||
[file_customization]
|
||||
|
||||
folder_colors={
|
||||
@@ -23,6 +31,14 @@ folder_colors={
|
||||
"res://scripts/": "green"
|
||||
}
|
||||
|
||||
[input]
|
||||
|
||||
shoot={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[gd_scene format=3 uid="uid://ium8i6770pf4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bfuhpow7x2xr1" path="res://scripts/bullet.gd" id="1_mkf8s"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_h1aey"]
|
||||
size = Vector2(12, 6)
|
||||
|
||||
[node name="Bullet" type="Area2D" unique_id=1756277677]
|
||||
script = ExtResource("1_mkf8s")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=646324606]
|
||||
shape = SubResource("RectangleShape2D_h1aey")
|
||||
debug_color = Color(0.93031675, 0.24960315, 0.23292288, 0.41960785)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
+43
-34
@@ -1,59 +1,68 @@
|
||||
[gd_scene format=3 uid="uid://cqk2rgy3m1chs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dxubdt7nh5s1j" path="res://scripts/gameController.gd" id="1_lnu2h"]
|
||||
[ext_resource type="Script" uid="uid://ch2id76i14srx" path="res://scripts/scene_manager.gd" id="2_iywne"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6lw2go5mwk3h" path="res://scenes/crate.tscn" id="2_lnu2h"]
|
||||
[ext_resource type="Script" uid="uid://c17de7vvtri1e" path="res://scripts/player.gd" id="2_yqjtg"]
|
||||
[ext_resource type="PackedScene" uid="uid://s0utas3jmhjk" path="res://scenes/player.tscn" id="3_iywne"]
|
||||
[ext_resource type="PackedScene" uid="uid://bf50mxdma8wq4" path="res://scenes/trigger.tscn" id="4_lbhrr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgi18lbutp5ui" path="res://scenes/npc_character.tscn" id="6_p57ef"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
|
||||
size = Vector2(74, 20)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_lbhrr"]
|
||||
|
||||
[node name="Game" type="Node2D" unique_id=239599901]
|
||||
script = ExtResource("1_lnu2h")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=2062716976]
|
||||
[node name="SceneManager" type="Node2D" parent="." unique_id=195147007]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("2_iywne")
|
||||
|
||||
[node name="Player" parent="." unique_id=161143934 instance=ExtResource("3_iywne")]
|
||||
position = Vector2(597, 416)
|
||||
|
||||
[node name="Triggers" type="Node2D" parent="." unique_id=1411399015]
|
||||
|
||||
[node name="Trigger" parent="Triggers" unique_id=1908774248 instance=ExtResource("4_lbhrr")]
|
||||
position = Vector2(692, 509)
|
||||
effect = "destroy"
|
||||
|
||||
[node name="Trigger2" parent="Triggers" unique_id=1627494044 instance=ExtResource("4_lbhrr")]
|
||||
position = Vector2(508, 507)
|
||||
effect = "teleport"
|
||||
|
||||
[node name="Trigger3" parent="Triggers" unique_id=1618797258 instance=ExtResource("4_lbhrr")]
|
||||
position = Vector2(572, 357)
|
||||
effect = "powerup"
|
||||
|
||||
[node name="Crates" type="Node2D" parent="." unique_id=1983554973]
|
||||
|
||||
[node name="Crate2" parent="Crates" unique_id=1988562966 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(660.9999, 413.99994)
|
||||
|
||||
[node name="Crate3" parent="Crates" unique_id=1771442258 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(575, 255)
|
||||
|
||||
[node name="Crate4" parent="Crates" unique_id=34543093 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(633.99994, 411)
|
||||
|
||||
[node name="Level" type="Node2D" parent="." unique_id=1225714734]
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="Level" unique_id=2062716976]
|
||||
position = Vector2(591, 442)
|
||||
scale = Vector2(2, 1)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1655047088]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D" unique_id=1655047088]
|
||||
shape = SubResource("RectangleShape2D_8cj0n")
|
||||
|
||||
[node name="Crate" parent="." unique_id=1307809047 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(644, 404)
|
||||
|
||||
[node name="Crate2" parent="." unique_id=1988562966 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(609, 403)
|
||||
|
||||
[node name="Player" type="CharacterBody2D" parent="." unique_id=1540403255]
|
||||
position = Vector2(535, 417)
|
||||
script = ExtResource("2_yqjtg")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player" unique_id=1365827185]
|
||||
shape = SubResource("CircleShape2D_uwrxv")
|
||||
debug_color = Color(0.28743955, 0.62438726, 0.25921708, 0.41960785)
|
||||
|
||||
[node name="Trigger" parent="." unique_id=1908774248 instance=ExtResource("4_lbhrr")]
|
||||
position = Vector2(692, 509)
|
||||
effect = "destroy"
|
||||
|
||||
[node name="Trigger2" parent="." unique_id=1627494044 instance=ExtResource("4_lbhrr")]
|
||||
position = Vector2(508, 507)
|
||||
|
||||
[node name="StaticBody2D2" type="StaticBody2D" parent="." unique_id=426786591]
|
||||
[node name="StaticBody2D2" type="StaticBody2D" parent="Level" unique_id=426786591]
|
||||
position = Vector2(601, 622)
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D2" unique_id=895098891]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D2" unique_id=895098891]
|
||||
shape = SubResource("WorldBoundaryShape2D_lbhrr")
|
||||
|
||||
[node name="Crate3" parent="." unique_id=1771442258 instance=ExtResource("2_lnu2h")]
|
||||
position = Vector2(570, 397)
|
||||
|
||||
[connection signal="AreaTrigger" from="Trigger" to="." method="_on_trigger"]
|
||||
[connection signal="AreaTrigger" from="Trigger2" to="." method="_on_trigger"]
|
||||
[node name="NPCCharacter" parent="." unique_id=847055918 instance=ExtResource("6_p57ef")]
|
||||
position = Vector2(536, 415)
|
||||
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://bgi18lbutp5ui"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://gutmbv5ff4u4" path="res://scripts/npc_character.gd" id="1_xtrxv"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5hyqr"]
|
||||
|
||||
[node name="NPCCharacter" type="CharacterBody2D" unique_id=847055918]
|
||||
script = ExtResource("1_xtrxv")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=351834440]
|
||||
shape = SubResource("CircleShape2D_5hyqr")
|
||||
debug_color = Color(0.91631323, 0.13193849, 0.63224995, 0.41960785)
|
||||
@@ -0,0 +1,203 @@
|
||||
[gd_scene format=3 uid="uid://s0utas3jmhjk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c17de7vvtri1e" path="res://scripts/player.gd" id="1_3vyb7"]
|
||||
[ext_resource type="Texture2D" uid="uid://bihghvekq435s" path="res://assets/graphics/player/jump_fall/player jump 48x48.png" id="2_dqkch"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyus25iplw8ei" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_g2els"]
|
||||
[ext_resource type="Texture2D" uid="uid://3c7ngirfyrkh" path="res://assets/graphics/player/running/player run 48x48.png" id="3_qhqgy"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
|
||||
atlas = ExtResource("2_dqkch")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(192, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(240, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(288, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(336, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(384, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
|
||||
atlas = ExtResource("2_g2els")
|
||||
region = Rect2(432, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
|
||||
atlas = ExtResource("2_dqkch")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
|
||||
atlas = ExtResource("2_dqkch")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(192, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(240, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(288, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"]
|
||||
atlas = ExtResource("3_qhqgy")
|
||||
region = Rect2(336, 0, 48, 48)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_jej6c"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i4ail")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"falling",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qhqgy")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dqkch")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qlg0r")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tuyoq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fjrip")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_smehm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ur7pv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_y4r1p")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d2wvv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3v2ag")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a38lo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4ni07")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"jumping",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jej6c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f1ej7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_oprun")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a8ls1")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qfm1y")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fulsm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4r5pv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_60mlk")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"running",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[node name="Player" type="CharacterBody2D" unique_id=161143934]
|
||||
script = ExtResource("1_3vyb7")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1128789199]
|
||||
shape = SubResource("CircleShape2D_uwrxv")
|
||||
debug_color = Color(0.28743955, 0.62438726, 0.25921708, 0.41960785)
|
||||
|
||||
[node name="RightTarget" type="Marker2D" parent="." unique_id=1084058194]
|
||||
position = Vector2(15, -3)
|
||||
|
||||
[node name="LeftTarget" type="Marker2D" parent="." unique_id=212282016]
|
||||
position = Vector2(-15, -3)
|
||||
|
||||
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="." unique_id=368198734]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -6)
|
||||
sprite_frames = SubResource("SpriteFrames_jej6c")
|
||||
animation = &"jumping"
|
||||
autoplay = "idle"
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=1107348196]
|
||||
|
||||
[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"]
|
||||
@@ -0,0 +1,21 @@
|
||||
class_name Bullet extends Area2D
|
||||
|
||||
var speed:float = 700
|
||||
|
||||
signal bulletDamageSignal(body: Node2D, bullet:Bullet)
|
||||
# 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:
|
||||
position += transform.x * speed *delta
|
||||
|
||||
func setSpeed(value:float)->void:
|
||||
speed = value
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("Bullet hit something")
|
||||
bulletDamageSignal.emit(body, self)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bfuhpow7x2xr1
|
||||
@@ -1 +1,13 @@
|
||||
class_name Crate extends RigidBody2D
|
||||
|
||||
var teleport_target: Vector2 = Vector2.ZERO
|
||||
var should_teleport: bool = false
|
||||
|
||||
func teleport_to(position:Vector2):
|
||||
teleport_target = position
|
||||
should_teleport = true
|
||||
|
||||
func _integrate_forces(state: PhysicsDirectBodyState2D) -> void:
|
||||
if should_teleport:
|
||||
state.transform = Transform2D.IDENTITY.translated(teleport_target)
|
||||
should_teleport = false
|
||||
+49
-10
@@ -1,23 +1,62 @@
|
||||
extends Node2D
|
||||
class_name GameController extends Node2D
|
||||
|
||||
var crateTotal = 3
|
||||
var crateTotal = 0
|
||||
signal destroySignal(body)
|
||||
signal teleportSignal(body)
|
||||
signal levelChangeSignal(level)
|
||||
var currentScene:String = "res://scenes/game.tscn"
|
||||
|
||||
var timer := Timer.new()
|
||||
var timeAvailable := 10
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
get_window().grab_focus()
|
||||
add_child(timer)
|
||||
timer.wait_time = 1
|
||||
timer.one_shot= false
|
||||
timer.connect("timeout", secondCounter)
|
||||
timer.start()
|
||||
|
||||
func secondCounter()->void:
|
||||
timeAvailable -=1
|
||||
if timeAvailable <=0:
|
||||
print("YOU LOSE BABY!!")
|
||||
levelChangeSignal.emit(currentScene)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_trigger(body: Variant, effect) -> void:
|
||||
print("GC knows trigger...."+effect)
|
||||
#Signals from Triggers!
|
||||
func _on_trigger(body: Variant, effect, trigger) -> void:
|
||||
#Crate triggers
|
||||
if body is Crate:
|
||||
match effect:
|
||||
"destroy":
|
||||
crateTotal -=1
|
||||
if crateTotal <=0:
|
||||
print("You WON!!!")
|
||||
body.queue_free()
|
||||
destroySignal.emit(body)
|
||||
"teleport":
|
||||
print("GC teleport an object")
|
||||
teleportSignal.emit(body)
|
||||
#Player triggers
|
||||
if body is Player:
|
||||
match effect:
|
||||
"powerup":
|
||||
print("GC knows about powerup")
|
||||
timeAvailable +=5
|
||||
destroySignal.emit(trigger)
|
||||
|
||||
func crateUpdate(cratesAmount)->void:
|
||||
crateTotal = cratesAmount
|
||||
if crateTotal <=0:
|
||||
print("You WON!!!")
|
||||
levelChangeSignal.emit(currentScene)
|
||||
|
||||
func bulletDamage(body:Node2D, bullet:Bullet)->void:
|
||||
print("GC knows bullet hit")
|
||||
if body is Crate:
|
||||
#destroy the crate?
|
||||
destroySignal.emit(body)
|
||||
#destroy the bullet?
|
||||
destroySignal.emit(bullet)
|
||||
@@ -0,0 +1,22 @@
|
||||
class_name NPCCharacter extends CharacterBody2D
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
handle_movement(delta)
|
||||
move_and_slide()
|
||||
handle_collisions()
|
||||
|
||||
func handle_movement(_delta)->void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * _delta
|
||||
func knockBack(direction, duration:float=0.2):
|
||||
velocity = direction
|
||||
await get_tree().create_timer(duration).timeout
|
||||
velocity = Vector2.ZERO
|
||||
func handle_collisions()->void:
|
||||
for i in get_slide_collision_count():
|
||||
var collision = get_slide_collision(i)
|
||||
var collider = collision.get_collider()
|
||||
# Check the collider's group or type
|
||||
if collider is Player:
|
||||
print("NPC hit by player")
|
||||
@@ -0,0 +1 @@
|
||||
uid://gutmbv5ff4u4
|
||||
+77
-6
@@ -1,30 +1,101 @@
|
||||
extends CharacterBody2D
|
||||
class_name Player extends CharacterBody2D
|
||||
|
||||
@onready var right_target: Marker2D = $RightTarget
|
||||
@onready var left_target: Marker2D = $LeftTarget
|
||||
@onready var player_graphic: AnimatedSprite2D = $PlayerGraphic
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
const BUMP_POWER = 50
|
||||
enum FaceDirection{LEFT, RIGHT}
|
||||
var facing:FaceDirection = FaceDirection.RIGHT
|
||||
#states for player
|
||||
enum PlayerState{IDLE,RUNNING,JUMPING, FALLING}
|
||||
var current_player_state:PlayerState = PlayerState.IDLE
|
||||
|
||||
var upJump:bool = false
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
handle_input()
|
||||
handle_movement(delta)
|
||||
handle_update_states()
|
||||
handle_update_animation()
|
||||
move_and_slide()
|
||||
handle_collisions()
|
||||
|
||||
#organize the game loop
|
||||
func handle_input()->void:
|
||||
# Handle Shoot
|
||||
if Input.is_action_just_pressed("shoot"):
|
||||
print("Player wants to shoot")
|
||||
match facing:
|
||||
FaceDirection.RIGHT:
|
||||
print("Shoot to the right")
|
||||
%SceneManager.makeBullet(right_target.global_transform, 700)
|
||||
FaceDirection.LEFT:
|
||||
print("Shoot to the left")
|
||||
%SceneManager.makeBullet(left_target.global_transform, -700)
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
current_player_state = PlayerState.JUMPING
|
||||
upJump = true
|
||||
|
||||
# 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 direction:
|
||||
velocity.x = direction * SPEED
|
||||
if direction <0:
|
||||
facing=FaceDirection.LEFT
|
||||
player_graphic.flip_h = true
|
||||
if direction >0:
|
||||
facing=FaceDirection.RIGHT
|
||||
player_graphic.flip_h = false
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
func handle_movement(_delta)->void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * _delta
|
||||
func handle_collisions()->void:
|
||||
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_POWER)
|
||||
if c.get_collider() is NPCCharacter:
|
||||
var direction = -c.get_normal()*BUMP_POWER
|
||||
c.get_collider().knockBack(direction)
|
||||
func handle_update_states()->void:
|
||||
match current_player_state:
|
||||
PlayerState.IDLE when velocity.x !=0:
|
||||
current_player_state = PlayerState.RUNNING
|
||||
PlayerState.RUNNING when velocity.x ==0:
|
||||
current_player_state = PlayerState.IDLE
|
||||
PlayerState.JUMPING when velocity.y >0:
|
||||
current_player_state = PlayerState.FALLING
|
||||
PlayerState.FALLING when is_on_floor():
|
||||
if velocity.x == 0:
|
||||
current_player_state = PlayerState.IDLE
|
||||
else:
|
||||
current_player_state = PlayerState.RUNNING
|
||||
func handle_update_animation()->void:
|
||||
match current_player_state:
|
||||
PlayerState.IDLE:
|
||||
player_graphic.play("idle")
|
||||
PlayerState.RUNNING:
|
||||
player_graphic.play("running")
|
||||
PlayerState.JUMPING:
|
||||
if upJump:
|
||||
player_graphic.play("jumping")
|
||||
PlayerState.FALLING:
|
||||
player_graphic.play("falling")
|
||||
|
||||
|
||||
func _on_animation_finished() -> void:
|
||||
match current_player_state:
|
||||
PlayerState.JUMPING:
|
||||
upJump = false
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
class_name SceneManager extends Node2D
|
||||
@onready var triggers: Node2D = $"../Triggers"
|
||||
@onready var crates: Node2D = $"../Crates"
|
||||
@onready var level: Node2D = $"../Level"
|
||||
@onready var game: GameController = $".."
|
||||
|
||||
#preloads for dynamic instantiation
|
||||
var bullet = preload("res://scenes/bullet.tscn")
|
||||
#array to keep track of bullets
|
||||
var bulletArray:Array[Bullet] = []
|
||||
#total number of bullets allowed to exist
|
||||
var totalAllowedBullets:int = 7
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
buildLevel()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func buildLevel()->void:
|
||||
print("building level")
|
||||
updateCrates()
|
||||
updateTriggers()
|
||||
|
||||
#wire up signals from GameController
|
||||
game.destroySignal.connect(destroy)
|
||||
game.teleportSignal.connect(teleport)
|
||||
game.levelChangeSignal.connect(loadLevel)
|
||||
|
||||
func updateTriggers()->void:
|
||||
if triggers:
|
||||
for obj in triggers.get_children():
|
||||
if obj is Trigger:
|
||||
if not obj.AreaTrigger.is_connected(game._on_trigger):
|
||||
obj.AreaTrigger.connect(game._on_trigger)
|
||||
|
||||
func updateCrates()->void:
|
||||
#check that there is a crates node
|
||||
if crates:
|
||||
var totalCrates = 0
|
||||
for obj in crates.get_children():
|
||||
if obj is Crate:
|
||||
if not obj.tree_exited.is_connected(updateCrates):
|
||||
obj.tree_exited.connect(updateCrates)
|
||||
totalCrates +=1
|
||||
game.crateUpdate(totalCrates)
|
||||
|
||||
func destroy(body)->void:
|
||||
if body is Bullet:
|
||||
bulletStash(body)
|
||||
return
|
||||
body.queue_free()
|
||||
func teleport(body)->void:
|
||||
if body is Crate:
|
||||
var viewport_size = get_viewport().get_visible_rect().size
|
||||
var random_x = randf_range(0, viewport_size.x)
|
||||
var random_y = randf_range(0, viewport_size.y)
|
||||
var newPosition = Vector2(random_x,random_y)
|
||||
body.teleport_to(newPosition)
|
||||
|
||||
func loadLevel(level:String)->void:
|
||||
get_tree().call_deferred("change_scene_to_file", level)
|
||||
|
||||
func bulletStash(bullet:Bullet)->void:
|
||||
var stashPosition:Vector2 = Vector2(-100,-100)
|
||||
bullet.position = stashPosition
|
||||
bullet.setSpeed(0)
|
||||
bullet.set_process(false)
|
||||
|
||||
func bulletFactory()->Bullet:
|
||||
var myBullet:Bullet
|
||||
if bulletArray.size() <= totalAllowedBullets:
|
||||
#make a new bullet
|
||||
myBullet = bullet.instantiate()
|
||||
#connect to the game controller
|
||||
if not myBullet.bulletDamageSignal.is_connected(game.bulletDamage):
|
||||
myBullet.bulletDamageSignal.connect(game.bulletDamage)
|
||||
|
||||
game.add_child(myBullet)
|
||||
else:
|
||||
myBullet = bulletArray.pop_back()
|
||||
|
||||
bulletArray.push_front(myBullet)
|
||||
return myBullet
|
||||
|
||||
func makeBullet(targetPosition, speed)->void:
|
||||
var myBullet:Bullet = bulletFactory()
|
||||
myBullet.transform = targetPosition
|
||||
myBullet.setSpeed(speed)
|
||||
myBullet.set_process(true)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://ch2id76i14srx
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
extends Area2D
|
||||
class_name Trigger extends Area2D
|
||||
|
||||
signal AreaTrigger(body, effect)
|
||||
signal AreaTrigger(body, effect, trigger)
|
||||
@export var effect="destroy"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -15,4 +15,4 @@ func _process(delta: float) -> void:
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("Trigger activated")
|
||||
AreaTrigger.emit(body, effect)
|
||||
AreaTrigger.emit(body, effect, self)
|
||||
Reference in new issue
Block a user