tilemap, state machine, player animations, scenemanager.
This commit is contained in:
parent
eac97fda20
commit
81ae9e63e5
BIN
Assets/Graphics/Player/Idle/Player Idle 48x48.png
Normal file
BIN
Assets/Graphics/Player/Idle/Player Idle 48x48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
34
Assets/Graphics/Player/Idle/Player Idle 48x48.png.import
Normal file
34
Assets/Graphics/Player/Idle/Player Idle 48x48.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://e6b480uw3m3f"
|
||||||
|
path="res://.godot/imported/Player Idle 48x48.png-43d8fdefecc09abb7b8a43ca7514cca3.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-43d8fdefecc09abb7b8a43ca7514cca3.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
Assets/Graphics/Player/Jump_Fall/player jump 48x48.png
Normal file
BIN
Assets/Graphics/Player/Jump_Fall/player jump 48x48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1021 B |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c3p0putnmoxj6"
|
||||||
|
path="res://.godot/imported/player jump 48x48.png-a956c6f5cb4913f8fce206d9961c58ce.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-a956c6f5cb4913f8fce206d9961c58ce.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
Assets/Graphics/Player/Run/player run 48x48.png
Normal file
BIN
Assets/Graphics/Player/Run/player run 48x48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
34
Assets/Graphics/Player/Run/player run 48x48.png.import
Normal file
34
Assets/Graphics/Player/Run/player run 48x48.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://liht8gn65vyk"
|
||||||
|
path="res://.godot/imported/player run 48x48.png-3c23f749058e47947519f4e375cf2db5.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Graphics/Player/Run/player run 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/player run 48x48.png-3c23f749058e47947519f4e375cf2db5.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
Assets/Graphics/enviroment/terrain/Terrain (32x32).png
Normal file
BIN
Assets/Graphics/enviroment/terrain/Terrain (32x32).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bu07bj38jivdy"
|
||||||
|
path="res://.godot/imported/Terrain (32x32).png-3092c2e99c8e2a730deb53412108a9a3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Graphics/enviroment/terrain/Terrain (32x32).png"
|
||||||
|
dest_files=["res://.godot/imported/Terrain (32x32).png-3092c2e99c8e2a730deb53412108a9a3.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
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=11 format=3 uid="uid://c3nfwlo4i3hne"]
|
[gd_scene load_steps=14 format=3 uid="uid://c3nfwlo4i3hne"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bt6s0tpg6lrha" path="res://Scripts/gamecontroller.gd" id="1_llgwy"]
|
[ext_resource type="Script" uid="uid://bt6s0tpg6lrha" path="res://Scripts/gamecontroller.gd" id="1_llgwy"]
|
||||||
[ext_resource type="Script" uid="uid://bukc3pev3h3fq" path="res://Scripts/scene_manager.gd" id="2_1l0tm"]
|
[ext_resource type="Script" uid="uid://bukc3pev3h3fq" path="res://Scripts/scene_manager.gd" id="2_1l0tm"]
|
||||||
@ -6,10 +6,66 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cjlmg7kqu5u5t" path="res://Scenes/crate.tscn" id="2_wowpa"]
|
[ext_resource type="PackedScene" uid="uid://cjlmg7kqu5u5t" path="res://Scenes/crate.tscn" id="2_wowpa"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c5qsdhrjyxbr1" path="res://Scenes/player.tscn" id="2_wrm1d"]
|
[ext_resource type="PackedScene" uid="uid://c5qsdhrjyxbr1" path="res://Scenes/player.tscn" id="2_wrm1d"]
|
||||||
[ext_resource type="Script" uid="uid://b7utyaqyc131x" path="res://Scripts/crate.gd" id="3_i6g32"]
|
[ext_resource type="Script" uid="uid://b7utyaqyc131x" path="res://Scripts/crate.gd" id="3_i6g32"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bu07bj38jivdy" path="res://Assets/Graphics/enviroment/terrain/Terrain (32x32).png" id="3_v158k"]
|
||||||
[ext_resource type="PackedScene" uid="uid://clevnux6u2ybx" path="res://Scenes/bullet.tscn" id="6_i6g32"]
|
[ext_resource type="PackedScene" uid="uid://clevnux6u2ybx" path="res://Scenes/bullet.tscn" id="6_i6g32"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_h4fw4"]
|
||||||
|
texture = ExtResource("3_v158k")
|
||||||
|
texture_region_size = Vector2i(32, 32)
|
||||||
|
0:0/0 = 0
|
||||||
|
1:0/0 = 0
|
||||||
|
2:0/0 = 0
|
||||||
|
4:0/0 = 0
|
||||||
|
6:0/0 = 0
|
||||||
|
7:0/0 = 0
|
||||||
|
9:0/0 = 0
|
||||||
|
10:0/0 = 0
|
||||||
|
12:0/0 = 0
|
||||||
|
13:0/0 = 0
|
||||||
|
15:0/0 = 0
|
||||||
|
0:1/0 = 0
|
||||||
|
1:1/0 = 0
|
||||||
|
2:1/0 = 0
|
||||||
|
4:1/0 = 0
|
||||||
|
6:1/0 = 0
|
||||||
|
7:1/0 = 0
|
||||||
|
9:1/0 = 0
|
||||||
|
10:1/0 = 0
|
||||||
|
12:1/0 = 0
|
||||||
|
13:1/0 = 0
|
||||||
|
15:1/0 = 0
|
||||||
|
16:1/0 = 0
|
||||||
|
0:2/0 = 0
|
||||||
|
1:2/0 = 0
|
||||||
|
2:2/0 = 0
|
||||||
|
4:2/0 = 0
|
||||||
|
6:3/0 = 0
|
||||||
|
7:3/0 = 0
|
||||||
|
9:3/0 = 0
|
||||||
|
10:3/0 = 0
|
||||||
|
12:3/0 = 0
|
||||||
|
13:3/0 = 0
|
||||||
|
15:3/0 = 0
|
||||||
|
16:3/0 = 0
|
||||||
|
0:4/0 = 0
|
||||||
|
1:4/0 = 0
|
||||||
|
2:4/0 = 0
|
||||||
|
4:4/0 = 0
|
||||||
|
6:4/0 = 0
|
||||||
|
7:4/0 = 0
|
||||||
|
9:4/0 = 0
|
||||||
|
10:4/0 = 0
|
||||||
|
12:4/0 = 0
|
||||||
|
13:4/0 = 0
|
||||||
|
15:4/0 = 0
|
||||||
|
16:4/0 = 0
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_ldgsr"]
|
||||||
|
tile_size = Vector2i(32, 32)
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_h4fw4")
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ejxeh"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ejxeh"]
|
||||||
size = Vector2(54, 20)
|
size = Vector2(93, 18)
|
||||||
|
|
||||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_0uq2f"]
|
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_0uq2f"]
|
||||||
|
|
||||||
@ -23,11 +79,18 @@ script = ExtResource("1_llgwy")
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("2_1l0tm")
|
script = ExtResource("2_1l0tm")
|
||||||
|
|
||||||
|
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
position = Vector2(191, 195)
|
||||||
|
tile_map_data = PackedByteArray(0, 0, 255, 255, 1, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 4, 0, 0, 0, 1, 0, 1, 0, 0, 0, 4, 0, 4, 0, 0, 0)
|
||||||
|
tile_set = SubResource("TileSet_ldgsr")
|
||||||
|
|
||||||
[node name="Platform" type="StaticBody2D" parent="."]
|
[node name="Platform" type="StaticBody2D" parent="."]
|
||||||
position = Vector2(213, 228)
|
position = Vector2(213, 228)
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform"]
|
||||||
|
position = Vector2(-8, 8)
|
||||||
shape = SubResource("RectangleShape2D_ejxeh")
|
shape = SubResource("RectangleShape2D_ejxeh")
|
||||||
|
|
||||||
[node name="Crate" parent="." instance=ExtResource("2_wowpa")]
|
[node name="Crate" parent="." instance=ExtResource("2_wowpa")]
|
||||||
@ -44,8 +107,7 @@ shape = SubResource("WorldBoundaryShape2D_0uq2f")
|
|||||||
[node name="Player" parent="." instance=ExtResource("2_wrm1d")]
|
[node name="Player" parent="." instance=ExtResource("2_wrm1d")]
|
||||||
position = Vector2(191, 195)
|
position = Vector2(191, 195)
|
||||||
|
|
||||||
[node name="Area2D" parent="." instance=ExtResource("2_ja4if")]
|
[node name="Camera2D" type="Camera2D" parent="Player"]
|
||||||
position = Vector2(279, 218)
|
|
||||||
|
|
||||||
[node name="Bullet" parent="." instance=ExtResource("6_i6g32")]
|
[node name="Bullet" parent="." instance=ExtResource("6_i6g32")]
|
||||||
position = Vector2(101, 87)
|
position = Vector2(101, 87)
|
||||||
@ -54,4 +116,10 @@ position = Vector2(101, 87)
|
|||||||
shape = SubResource("RectangleShape2D_1l0tm")
|
shape = SubResource("RectangleShape2D_1l0tm")
|
||||||
debug_color = Color(0.997962, 0, 0.153889, 0.42)
|
debug_color = Color(0.997962, 0, 0.153889, 0.42)
|
||||||
|
|
||||||
[connection signal="areaTriggerSignal" from="Area2D" to="." method="_on_trigger"]
|
[node name="triggers" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="player_hurt" parent="triggers" instance=ExtResource("2_ja4if")]
|
||||||
|
position = Vector2(294, 211)
|
||||||
|
effect = "player_hurt"
|
||||||
|
|
||||||
|
[connection signal="areaTriggerSignal" from="triggers/player_hurt" to="." method="_on_trigger"]
|
||||||
|
@ -1,13 +1,185 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://c5qsdhrjyxbr1"]
|
[gd_scene load_steps=28 format=3 uid="uid://c5qsdhrjyxbr1"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://crc2khytlo6r" path="res://Scripts/character_1.gd" id="1_v0iea"]
|
[ext_resource type="Script" uid="uid://crc2khytlo6r" path="res://Scripts/character_1.gd" id="1_v0iea"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://e6b480uw3m3f" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_cvnsp"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c3p0putnmoxj6" path="res://Assets/Graphics/Player/Jump_Fall/player jump 48x48.png" id="2_vgqql"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://liht8gn65vyk" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_6t5aa"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_4vo57"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_4vo57"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_olqyp"]
|
||||||
|
atlas = ExtResource("2_vgqql")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_6t5aa"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vgqql"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fkybt"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_x3wgy"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3smsa"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8erm5"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ek2"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tx1dd"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gymyn"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(384, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_pu2lt"]
|
||||||
|
atlas = ExtResource("2_cvnsp")
|
||||||
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wpjfl"]
|
||||||
|
atlas = ExtResource("2_vgqql")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_bi64h"]
|
||||||
|
atlas = ExtResource("2_vgqql")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ukyrk"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7dp3o"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_h4iuc"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fd4e3"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qqcod"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_igrcy"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fs7ks"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_l6n3p"]
|
||||||
|
atlas = ExtResource("3_6t5aa")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_ukyrk"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_olqyp")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"fall",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_6t5aa")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vgqql")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fkybt")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_x3wgy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_3smsa")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_8erm5")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_f1ek2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_tx1dd")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_gymyn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_pu2lt")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_wpjfl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_bi64h")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"jump",
|
||||||
|
"speed": 12.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ukyrk")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7dp3o")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_h4iuc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fd4e3")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_qqcod")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_igrcy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fs7ks")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_l6n3p")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"run",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
[node name="Player" type="CharacterBody2D"]
|
||||||
position = Vector2(-21, -4)
|
position = Vector2(-20, -4)
|
||||||
script = ExtResource("1_v0iea")
|
script = ExtResource("1_v0iea")
|
||||||
metadata/_edit_group_ = true
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(21, 4)
|
position = Vector2(21, 4)
|
||||||
@ -27,3 +199,17 @@ metadata/_edit_group_ = true
|
|||||||
|
|
||||||
[node name="LeftSpawn" type="Node2D" parent="."]
|
[node name="LeftSpawn" type="Node2D" parent="."]
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="JumpBufferTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 0.8
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="playergraphic" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
position = Vector2(22, 1)
|
||||||
|
scale = Vector2(0.833333, 0.770833)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_ukyrk")
|
||||||
|
animation = &"fall"
|
||||||
|
autoplay = "idle"
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="playergraphic" to="." method="_on_animation_finished"]
|
||||||
|
@ -4,44 +4,99 @@ class_name Player extends CharacterBody2D
|
|||||||
@onready var right_cast: RayCast2D = $"Right Cast"
|
@onready var right_cast: RayCast2D = $"Right Cast"
|
||||||
@onready var left_spawn: Node2D = $LeftSpawn
|
@onready var left_spawn: Node2D = $LeftSpawn
|
||||||
@onready var right_spawn: Node2D = $RightSpawn
|
@onready var right_spawn: Node2D = $RightSpawn
|
||||||
|
@onready var jump_buffer_timer = $JumpBufferTimer
|
||||||
|
@onready var playergraphic = $playergraphic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const SPEED = 300.0
|
const SPEED = 300.0
|
||||||
const JUMP_VELOCITY = -400.0
|
const JUMP_VELOCITY = -400.0
|
||||||
|
var acceleration:int = 20
|
||||||
|
var upJump:bool = false
|
||||||
|
|
||||||
var direction
|
var direction
|
||||||
enum FaceDirection{LEFT, RIGHT}
|
enum FaceDirection{LEFT, RIGHT}
|
||||||
var facing:FaceDirection = FaceDirection.RIGHT
|
var facing:FaceDirection = FaceDirection.RIGHT
|
||||||
|
enum State{IDLE,RUN,JUMP,FALLING}
|
||||||
|
var current_state:State = State.IDLE
|
||||||
|
|
||||||
|
|
||||||
var pushTarget
|
var pushTarget
|
||||||
var pushEnabled := false
|
var pushEnabled := false
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handle_input()
|
handle_input()
|
||||||
handle_movement(delta)
|
handle_movement(delta)
|
||||||
|
handle_states()
|
||||||
|
handle_animation()
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
handle_collisions()
|
handle_collisions()
|
||||||
|
|
||||||
func handle_movement(delta):
|
func handle_states() -> void:
|
||||||
if direction:
|
match current_state:
|
||||||
velocity.x = direction * SPEED
|
State.IDLE when velocity.x !=0:
|
||||||
else:
|
current_state = State.RUN
|
||||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
State.RUN:
|
||||||
|
if velocity.x == 0:
|
||||||
|
current_state = State.IDLE
|
||||||
|
# player steps off ledge
|
||||||
|
if not is_on_floor() && velocity.y > 0:
|
||||||
|
current_state = State.FALLING
|
||||||
|
|
||||||
|
State.FALLING when is_on_floor():
|
||||||
|
if velocity.x == 0:
|
||||||
|
current_state = State.IDLE
|
||||||
|
else: current_state = State.RUN
|
||||||
|
|
||||||
|
State.JUMP when velocity.y >0:
|
||||||
|
current_state = State.FALLING
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func handle_animation() -> void:
|
||||||
|
match current_state:
|
||||||
|
State.IDLE:
|
||||||
|
playergraphic.play("idle")
|
||||||
|
State.RUN:
|
||||||
|
playergraphic.play("run")
|
||||||
|
State.FALLING:
|
||||||
|
playergraphic.play("fall")
|
||||||
|
State.JUMP:
|
||||||
|
if upJump:
|
||||||
|
playergraphic.play("jump")
|
||||||
|
|
||||||
if not is_on_floor():
|
|
||||||
velocity += get_gravity() * delta
|
func handle_movement(delta:float) -> void:
|
||||||
|
if direction == 0:
|
||||||
|
#not moving
|
||||||
|
velocity.x = move_toward(velocity.x,0, acceleration)
|
||||||
|
else: velocity.x = move_toward(velocity.x, SPEED * direction, acceleration)
|
||||||
|
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity += get_gravity() * delta
|
||||||
|
if is_on_floor() && jump_buffer_timer.time_left >0:
|
||||||
|
velocity.y = JUMP_VELOCITY
|
||||||
|
jump_buffer_timer.stop()
|
||||||
|
current_state = State.JUMP
|
||||||
|
upJump = true
|
||||||
|
|
||||||
func handle_input():
|
func handle_input():
|
||||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||||
velocity.y = JUMP_VELOCITY
|
#velocity.y = JUMP_VELOCITY
|
||||||
|
jump_buffer_timer.start()
|
||||||
|
|
||||||
direction = Input.get_axis("ui_left", "ui_right")
|
direction = Input.get_axis("ui_left", "ui_right")
|
||||||
if direction < 0:
|
if direction < 0:
|
||||||
facing = FaceDirection.LEFT
|
facing = FaceDirection.LEFT
|
||||||
|
playergraphic.flip_h = true
|
||||||
if direction > 0:
|
if direction > 0:
|
||||||
facing = FaceDirection.RIGHT
|
facing = FaceDirection.RIGHT
|
||||||
|
playergraphic.flip_h = false
|
||||||
if Input.is_action_just_pressed("shove") && pushEnabled:
|
if Input.is_action_just_pressed("shove") && pushEnabled:
|
||||||
var shoveDirection:int
|
var shoveDirection:int
|
||||||
match facing:
|
match facing:
|
||||||
@ -82,3 +137,9 @@ func handle_collisions():
|
|||||||
if not right_cast.is_colliding() && not left_cast.is_colliding():
|
if not right_cast.is_colliding() && not left_cast.is_colliding():
|
||||||
pushEnabled = false
|
pushEnabled = false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animation_finished() -> void:
|
||||||
|
match current_state:
|
||||||
|
State.JUMP:
|
||||||
|
upJump = false
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
signal playerDamage
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@ -13,6 +14,11 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
func _on_trigger(effect: Variant, body: Variant) -> void:
|
func _on_trigger(effect: Variant, body: Variant) -> void:
|
||||||
print("GC sees trigger "+effect)
|
print("GC sees trigger "+effect)
|
||||||
|
match effect:
|
||||||
|
"player_hurt":
|
||||||
|
if body is Player:
|
||||||
|
print("hurt the player")
|
||||||
|
playerDamage.emit()
|
||||||
if not body is Player:
|
if not body is Player:
|
||||||
body.queue_free()
|
body.queue_free()
|
||||||
|
|
||||||
|
@ -3,10 +3,16 @@ var bulletArray = []
|
|||||||
var totalAllowedBullets = 7
|
var totalAllowedBullets = 7
|
||||||
var bullet = preload("res://Scenes/bullet.tscn")
|
var bullet = preload("res://Scenes/bullet.tscn")
|
||||||
@onready var game: Node2D = $".."
|
@onready var game: Node2D = $".."
|
||||||
|
@onready var triggers = $"../triggers"
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
if triggers:
|
||||||
|
for obj in triggers.get_children():
|
||||||
|
if obj is Trigger:
|
||||||
|
obj.areaTriggerSignal.connect(game._on_trigger)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
extends Area2D
|
class_name Trigger extends Area2D
|
||||||
|
|
||||||
@export var effect := "destroy"
|
@export var effect := "destroy"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user