diff --git a/assets/graphics/env/terrain/Terrain (32x32).png b/assets/graphics/env/terrain/Terrain (32x32).png new file mode 100644 index 0000000..ddf1eaf Binary files /dev/null and b/assets/graphics/env/terrain/Terrain (32x32).png differ diff --git a/assets/graphics/env/terrain/Terrain (32x32).png.import b/assets/graphics/env/terrain/Terrain (32x32).png.import new file mode 100644 index 0000000..2bf88b6 --- /dev/null +++ b/assets/graphics/env/terrain/Terrain (32x32).png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cy2xlq65lg2b" +path="res://.godot/imported/Terrain (32x32).png-08fff74632257c258bdc4bf4ea1a123f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/env/terrain/Terrain (32x32).png" +dest_files=["res://.godot/imported/Terrain (32x32).png-08fff74632257c258bdc4bf4ea1a123f.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 diff --git a/assets/graphics/objects/crate.png b/assets/graphics/objects/crate.png new file mode 100644 index 0000000..2b8bdcd Binary files /dev/null and b/assets/graphics/objects/crate.png differ diff --git a/assets/graphics/objects/crate.png.import b/assets/graphics/objects/crate.png.import new file mode 100644 index 0000000..c4c1d2e --- /dev/null +++ b/assets/graphics/objects/crate.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://coi8g37b0f7es" +path="res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/objects/crate.png" +dest_files=["res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.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 diff --git a/assets/graphics/player/idle/Player Idle 48x48.png b/assets/graphics/player/idle/Player Idle 48x48.png new file mode 100644 index 0000000..b618511 Binary files /dev/null and b/assets/graphics/player/idle/Player Idle 48x48.png differ diff --git a/assets/graphics/player/idle/Player Idle 48x48.png.import b/assets/graphics/player/idle/Player Idle 48x48.png.import new file mode 100644 index 0000000..619b883 --- /dev/null +++ b/assets/graphics/player/idle/Player Idle 48x48.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bb6uc2alre1qu" +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 diff --git a/assets/graphics/player/jumpandfall/player jump 48x48.png b/assets/graphics/player/jumpandfall/player jump 48x48.png new file mode 100644 index 0000000..dff105c Binary files /dev/null and b/assets/graphics/player/jumpandfall/player jump 48x48.png differ diff --git a/assets/graphics/player/jumpandfall/player jump 48x48.png.import b/assets/graphics/player/jumpandfall/player jump 48x48.png.import new file mode 100644 index 0000000..8addd6e --- /dev/null +++ b/assets/graphics/player/jumpandfall/player jump 48x48.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dr8leuj7yjpmo" +path="res://.godot/imported/player jump 48x48.png-edea6600ba0b9bf536bde1d00983fd16.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/player/jumpandfall/player jump 48x48.png" +dest_files=["res://.godot/imported/player jump 48x48.png-edea6600ba0b9bf536bde1d00983fd16.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 diff --git a/assets/graphics/player/run/player run 48x48.png b/assets/graphics/player/run/player run 48x48.png new file mode 100644 index 0000000..aca5b55 Binary files /dev/null and b/assets/graphics/player/run/player run 48x48.png differ diff --git a/assets/graphics/player/run/player run 48x48.png.import b/assets/graphics/player/run/player run 48x48.png.import new file mode 100644 index 0000000..dedea43 --- /dev/null +++ b/assets/graphics/player/run/player run 48x48.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://gat5giebysdj" +path="res://.godot/imported/player run 48x48.png-6d66612d48bfa4c8721495ba557ab7c6.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-6d66612d48bfa4c8721495ba557ab7c6.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 diff --git a/assets/graphics/player/shove/Player Punch 64x64.png b/assets/graphics/player/shove/Player Punch 64x64.png new file mode 100644 index 0000000..c9a4660 Binary files /dev/null and b/assets/graphics/player/shove/Player Punch 64x64.png differ diff --git a/assets/graphics/player/shove/Player Punch 64x64.png.import b/assets/graphics/player/shove/Player Punch 64x64.png.import new file mode 100644 index 0000000..4d8388a --- /dev/null +++ b/assets/graphics/player/shove/Player Punch 64x64.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://csmss00eyd21r" +path="res://.godot/imported/Player Punch 64x64.png-e42127c3286f806d366b880ff4e58ed8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/player/shove/Player Punch 64x64.png" +dest_files=["res://.godot/imported/Player Punch 64x64.png-e42127c3286f806d366b880ff4e58ed8.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 diff --git a/assets/graphics/projectiles/pixel_bullet.png b/assets/graphics/projectiles/pixel_bullet.png new file mode 100644 index 0000000..900d030 Binary files /dev/null and b/assets/graphics/projectiles/pixel_bullet.png differ diff --git a/assets/graphics/projectiles/pixel_bullet.png.import b/assets/graphics/projectiles/pixel_bullet.png.import new file mode 100644 index 0000000..f62cf5b --- /dev/null +++ b/assets/graphics/projectiles/pixel_bullet.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bc8cpuacrbf0y" +path="res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/projectiles/pixel_bullet.png" +dest_files=["res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.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 diff --git a/project.godot b/project.godot index c67d326..4fd739a 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,14 @@ run/main_scene="uid://cy1i6ucex6m0d" config/features=PackedStringArray("4.5", "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={ diff --git a/scenes/bullet.tscn b/scenes/bullet.tscn index f9d1af9..55b890f 100644 --- a/scenes/bullet.tscn +++ b/scenes/bullet.tscn @@ -1,14 +1,21 @@ -[gd_scene load_steps=3 format=3 uid="uid://daa6idpu4gkat"] +[gd_scene load_steps=4 format=3 uid="uid://daa6idpu4gkat"] [ext_resource type="Script" uid="uid://cbp3pm7i587mv" path="res://scripts/bullet.gd" id="1_mkf8s"] +[ext_resource type="Texture2D" uid="uid://bc8cpuacrbf0y" path="res://assets/graphics/projectiles/pixel_bullet.png" id="2_y25gk"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_h1aey"] size = Vector2(4, 2) [node name="Bullet" type="Area2D"] -scale = Vector2(3.2338707, 2.7645516) +scale = Vector2(34.677, 20) script = ExtResource("1_mkf8s") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_h1aey") debug_color = Color(0.78294253, 0.1467745, 0.21462014, 0.41960785) + +[node name="BulletGraphic" type="Sprite2D" parent="."] +texture_filter = 1 +position = Vector2(-1.8553616, -1.0851669) +scale = Vector2(-0.048501078, -0.040855687) +texture = ExtResource("2_y25gk") diff --git a/scenes/crate.tscn b/scenes/crate.tscn index 3c7724f..8e6eed0 100644 --- a/scenes/crate.tscn +++ b/scenes/crate.tscn @@ -1,11 +1,17 @@ -[gd_scene load_steps=2 format=3 uid="uid://qv8blu8wkqvq"] +[gd_scene load_steps=3 format=3 uid="uid://qv8blu8wkqvq"] + +[ext_resource type="Texture2D" uid="uid://coi8g37b0f7es" path="res://assets/graphics/objects/crate.png" id="1_b66cd"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"] [node name="Crate" type="RigidBody2D"] -rotation = -0.36065605 metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_uwrxv") debug_color = Color(0.90240496, 0.29881617, 0.21305403, 0.41960785) + +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(0, 1) +scale = Vector2(0.07, 0.07) +texture = ExtResource("1_b66cd") diff --git a/scenes/game.tscn b/scenes/game.tscn index 440fd25..aa30f89 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,15 +1,208 @@ -[gd_scene load_steps=10 format=3 uid="uid://cy1i6ucex6m0d"] +[gd_scene load_steps=13 format=4 uid="uid://cy1i6ucex6m0d"] [ext_resource type="Script" uid="uid://c546prectbgc7" path="res://scripts/gamecontroller.gd" id="1_lbhrr"] [ext_resource type="PackedScene" uid="uid://qv8blu8wkqvq" path="res://scenes/crate.tscn" id="1_uwrxv"] -[ext_resource type="PackedScene" uid="uid://daa6idpu4gkat" path="res://scenes/bullet.tscn" id="2_iywne"] [ext_resource type="Script" uid="uid://barmq4qhp5cvl" path="res://scripts/scene_manager.gd" id="2_p57ef"] +[ext_resource type="Texture2D" uid="uid://cy2xlq65lg2b" path="res://assets/graphics/env/terrain/Terrain (32x32).png" id="2_u5sy4"] [ext_resource type="PackedScene" uid="uid://dmrrbiwqptrho" path="res://scenes/trigger.tscn" id="2_yqjtg"] [ext_resource type="PackedScene" uid="uid://b1yy0sybg66hh" path="res://scenes/player.tscn" id="3_lnu2h"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"] +[sub_resource type="TileMapPattern" id="TileMapPattern_p57ef"] +tile_data = PackedInt32Array(0, 0, 4, 1, 65536, 4, 2, 65536, 4, 3, 65536, 4, 4, 131072, 4) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"] +[sub_resource type="TileMapPattern" id="TileMapPattern_u5sy4"] +tile_data = PackedInt32Array(0, 0, 4, 1, 65536, 4, 2, 65536, 4, 3, 65536, 4, 4, 131072, 4) + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gee14"] +texture = ExtResource("2_u5sy4") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/terrain_set = 0 +0:0/0/terrains_peering_bit/bottom_right_corner = 0 +0:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0 = 0 +1:0/0/terrain_set = 0 +1:0/0/terrains_peering_bit/bottom_right_corner = 0 +1:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0/terrains_peering_bit/bottom_left_corner = 0 +2:0/0 = 0 +2:0/0/terrain_set = 0 +2:0/0/terrains_peering_bit/bottom_side = 0 +2:0/0/terrains_peering_bit/bottom_left_corner = 0 +4:0/0 = 0 +4:0/0/terrain_set = 0 +4:0/0/terrain = 0 +4:0/0/terrains_peering_bit/bottom_side = 0 +6:0/0 = 0 +6:0/0/terrain_set = 0 +6:0/0/terrains_peering_bit/bottom_left_corner = 0 +6:0/0/terrains_peering_bit/left_side = 0 +6:0/0/terrains_peering_bit/top_left_corner = 0 +6:0/0/terrains_peering_bit/top_side = 0 +6:0/0/terrains_peering_bit/top_right_corner = 0 +7:0/0 = 0 +7:0/0/terrain_set = 0 +7:0/0/terrains_peering_bit/right_side = 0 +7:0/0/terrains_peering_bit/bottom_right_corner = 0 +7:0/0/terrains_peering_bit/top_left_corner = 0 +7:0/0/terrains_peering_bit/top_side = 0 +7:0/0/terrains_peering_bit/top_right_corner = 0 +9:0/0 = 0 +9:0/0/terrain_set = 0 +9:0/0/terrain = 0 +9:0/0/terrains_peering_bit/bottom_right_corner = 0 +9:0/0/terrains_peering_bit/bottom_side = 0 +9:0/0/terrains_peering_bit/bottom_left_corner = 0 +9:0/0/terrains_peering_bit/top_side = 0 +10:0/0 = 0 +10:0/0/terrain_set = 0 +10:0/0/terrain = 0 +10:0/0/terrains_peering_bit/bottom_side = 0 +10:0/0/terrains_peering_bit/bottom_left_corner = 0 +10:0/0/terrains_peering_bit/left_side = 0 +10:0/0/terrains_peering_bit/top_left_corner = 0 +10:0/0/terrains_peering_bit/top_side = 0 +12:0/0 = 0 +13:0/0 = 0 +15:0/0 = 0 +0:1/0 = 0 +0:1/0/terrain_set = 0 +0:1/0/terrain = 0 +0:1/0/terrains_peering_bit/right_side = 0 +0:1/0/terrains_peering_bit/bottom_right_corner = 0 +0:1/0/terrains_peering_bit/bottom_side = 0 +0:1/0/terrains_peering_bit/top_side = 0 +0:1/0/terrains_peering_bit/top_right_corner = 0 +1:1/0 = 0 +1:1/0/terrain_set = 0 +1:1/0/terrain = 0 +1:1/0/terrains_peering_bit/right_side = 0 +1:1/0/terrains_peering_bit/bottom_right_corner = 0 +1:1/0/terrains_peering_bit/bottom_side = 0 +1:1/0/terrains_peering_bit/bottom_left_corner = 0 +1:1/0/terrains_peering_bit/left_side = 0 +1:1/0/terrains_peering_bit/top_left_corner = 0 +1:1/0/terrains_peering_bit/top_side = 0 +1:1/0/terrains_peering_bit/top_right_corner = 0 +2:1/0 = 0 +2:1/0/terrain_set = 0 +2:1/0/terrain = 0 +2:1/0/terrains_peering_bit/bottom_side = 0 +2:1/0/terrains_peering_bit/bottom_left_corner = 0 +2:1/0/terrains_peering_bit/left_side = 0 +2:1/0/terrains_peering_bit/top_left_corner = 0 +2:1/0/terrains_peering_bit/top_side = 0 +4:1/0 = 0 +4:1/0/terrain_set = 0 +4:1/0/terrain = 0 +4:1/0/terrains_peering_bit/bottom_side = 0 +4:1/0/terrains_peering_bit/top_side = 0 +6:1/0 = 0 +6:1/0/terrain_set = 0 +6:1/0/terrains_peering_bit/bottom_right_corner = 0 +6:1/0/terrains_peering_bit/bottom_side = 0 +6:1/0/terrains_peering_bit/bottom_left_corner = 0 +6:1/0/terrains_peering_bit/left_side = 0 +6:1/0/terrains_peering_bit/top_left_corner = 0 +7:1/0 = 0 +7:1/0/terrain_set = 0 +7:1/0/terrains_peering_bit/right_side = 0 +7:1/0/terrains_peering_bit/bottom_right_corner = 0 +7:1/0/terrains_peering_bit/bottom_side = 0 +7:1/0/terrains_peering_bit/bottom_left_corner = 0 +7:1/0/terrains_peering_bit/top_right_corner = 0 +9:1/0 = 0 +9:1/0/terrain_set = 0 +9:1/0/terrain = 0 +9:1/0/terrains_peering_bit/right_side = 0 +9:1/0/terrains_peering_bit/bottom_right_corner = 0 +9:1/0/terrains_peering_bit/bottom_side = 0 +9:1/0/terrains_peering_bit/top_side = 0 +9:1/0/terrains_peering_bit/top_right_corner = 0 +10:1/0 = 0 +10:1/0/terrain_set = 0 +10:1/0/terrain = 0 +10:1/0/terrains_peering_bit/right_side = 0 +10:1/0/terrains_peering_bit/bottom_side = 0 +10:1/0/terrains_peering_bit/left_side = 0 +10:1/0/terrains_peering_bit/top_left_corner = 0 +10:1/0/terrains_peering_bit/top_side = 0 +10:1/0/terrains_peering_bit/top_right_corner = 0 +12:1/0 = 0 +13:1/0 = 0 +15:1/0 = 0 +16:1/0 = 0 +0:2/0 = 0 +0:2/0/terrain_set = 0 +0:2/0/terrain = 0 +0:2/0/terrains_peering_bit/right_side = 0 +0:2/0/terrains_peering_bit/top_side = 0 +0:2/0/terrains_peering_bit/top_right_corner = 0 +1:2/0 = 0 +1:2/0/terrain_set = 0 +1:2/0/terrain = 0 +1:2/0/terrains_peering_bit/right_side = 0 +1:2/0/terrains_peering_bit/left_side = 0 +1:2/0/terrains_peering_bit/top_left_corner = 0 +1:2/0/terrains_peering_bit/top_side = 0 +1:2/0/terrains_peering_bit/top_right_corner = 0 +2:2/0 = 0 +2:2/0/terrain_set = 0 +2:2/0/terrain = 0 +2:2/0/terrains_peering_bit/left_side = 0 +2:2/0/terrains_peering_bit/top_left_corner = 0 +2:2/0/terrains_peering_bit/top_side = 0 +4:2/0 = 0 +4:2/0/terrain_set = 0 +4:2/0/terrain = 0 +4:2/0/terrains_peering_bit/top_side = 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 +0:4/0/terrain_set = 0 +0:4/0/terrain = 0 +0:4/0/terrains_peering_bit/right_side = 0 +1:4/0 = 0 +1:4/0/terrain_set = 0 +1:4/0/terrain = 0 +1:4/0/terrains_peering_bit/right_side = 0 +1:4/0/terrains_peering_bit/left_side = 0 +2:4/0 = 0 +2:4/0/terrain_set = 0 +2:4/0/terrain = 0 +2:4/0/terrains_peering_bit/left_side = 0 +4:4/0 = 0 +4:4/0/terrain_set = 0 +4:4/0/terrain = 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 +4:3/0 = 0 +3:3/0 = 0 +3:2/0 = 0 +3:1/0 = 0 + +[sub_resource type="TileSet" id="TileSet_0tnpc"] +tile_size = Vector2i(32, 32) +terrain_set_0/mode = 0 +terrain_set_0/terrain_0/name = "LeafyDirt" +terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1) +sources/0 = SubResource("TileSetAtlasSource_gee14") +pattern_0 = SubResource("TileMapPattern_p57ef") +pattern_1 = SubResource("TileMapPattern_u5sy4") + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_8cj0n"] @@ -17,6 +210,10 @@ position = Vector2(6, 2) script = ExtResource("1_lbhrr") +[node name="TileMapLayer" type="TileMapLayer" parent="."] +tile_map_data = PackedByteArray("AAADAAcAAAAEAAQAAAAEAAcAAAAEAAQAAAACAAcAAAAEAAQAAAABAAwAAAABAAQAAAACAAwAAAABAAQAAAADAAwAAAABAAQAAAAEAAwAAAABAAQAAAD9/wwAAAABAAQAAAD+/wwAAAABAAQAAAD//wwAAAACAAQAAAD//w0AAAACAAQAAAD+/w0AAAAAAAQAAAD0/wwAAAACAAQAAAD1/wsAAAAAAAIAAAD2/wsAAAABAAIAAAD3/wwAAAAAAAIAAAD3/wsAAAAKAAEAAAD4/wwAAAAKAAEAAAD4/wsAAAABAAEAAAD5/wwAAAABAAEAAAD5/wsAAAABAAEAAAD5/woAAAABAAEAAAD5/wkAAAABAAEAAAD4/wkAAAABAAEAAAD4/wgAAAABAAAAAAD5/wgAAAABAAAAAAD3/wkAAAABAAEAAAD3/wgAAAACAAEAAAD2/wkAAAAKAAEAAAD2/wgAAAABAAEAAAD1/wkAAAAKAAEAAAD1/wgAAAAJAAEAAAD1/woAAAAKAAEAAAD0/woAAAAAAAIAAAD0/wkAAAAKAAEAAAD2/woAAAABAAEAAAD4/woAAAABAAEAAAD2/wcAAAABAAAAAAD3/wcAAAACAAAAAAD1/wcAAAAAAAAAAAD0/wgAAAAGAAEAAAD3/woAAAABAAEAAAD1/w4AAAABAAEAAAD2/w4AAAACAAEAAAD5/w4AAAAAAAIAAAD4/w8AAAACAAQAAAD3/w8AAAAKAAAAAAD2/w8AAAABAAEAAAD1/w8AAAAJAAEAAAD6/w8AAAAAAAIAAAD6/w4AAAAKAAEAAAD3/xAAAAABAAEAAAD2/xAAAAABAAEAAAD2/xEAAAAAAAIAAAD3/xEAAAABAAIAAAD4/xEAAAABAAIAAAD5/xEAAAACAAIAAAD6/xEAAAAEAAAAAAD5/w0AAAAKAAEAAAD6/w0AAAAKAAAAAAD5/xAAAAAEAAAAAAD4/xAAAAACAAEAAAD4/w0AAAAAAAIAAAD7/w4AAAABAAEAAAD7/w8AAAABAAIAAAD7/w0AAAAHAAEAAAD8/w8AAAACAAIAAAD1/w0AAAAKAAAAAAD0/w4AAAABAAIAAAD0/w0AAAABAAEAAADz/w0AAAAAAAEAAADz/w4AAAAAAAIAAADz/wwAAAACAAAAAAD6/wsAAAAKAAAAAAD6/wwAAAAKAAAAAAD6/wkAAAACAAEAAAD6/woAAAACAAEAAAD6/wgAAAACAAAAAAD7/wwAAAABAAQAAAD8/wwAAAAKAAEAAAD8/w0AAAAKAAAAAAD8/w4AAAAKAAAAAADz/wkAAAAAAAIAAADy/wgAAAAAAAIAAADx/wcAAAAAAAIAAADy/wcAAAAKAAEAAADx/wYAAAAAAAAAAADy/wYAAAACAAAAAADz/wgAAAAKAAEAAADz/wcAAAAGAAEAAAD8/xIAAAACAAQAAAD7/xIAAAABAAIAAAD6/xIAAAABAAIAAAD5/xIAAAAAAAQAAAD7/xEAAAAAAAAAAAD0/xAAAAAAAAQAAAD1/xAAAAAAAAIAAADz/w8AAAAEAAIAAADy/w8AAAAAAAQAAADx/w4AAAACAAQAAADw/w4AAAAAAAQAAADv/w0AAAAEAAIAAADv/wwAAAAEAAAAAADu/wwAAAAAAAQAAAD//woAAAAAAAQAAAAAAAoAAAABAAQAAAABAAoAAAABAAQAAAACAAoAAAABAAQAAAADAAoAAAACAAQAAAA=") +tile_set = SubResource("TileSet_0tnpc") + [node name="SceneManager" type="Node2D" parent="."] unique_name_in_owner = true script = ExtResource("2_p57ef") @@ -48,16 +245,11 @@ metadata/_edit_group_ = true shape = SubResource("RectangleShape2D_8cj0n") [node name="Crate" parent="." groups=["explodable", "pushable"] instance=ExtResource("1_uwrxv")] -position = Vector2(112, 186) +position = Vector2(114, 175) -[node name="Crate2" type="RigidBody2D" parent="." groups=["explodable", "pushable"]] -position = Vector2(147.99998, 202.99994) -rotation = 2.6595373 -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Crate2"] -shape = SubResource("RectangleShape2D_uwrxv") -debug_color = Color(0.90240496, 0.29881617, 0.21305403, 0.41960785) +[node name="Crate2" parent="." groups=["explodable", "pushable"] instance=ExtResource("1_uwrxv")] +position = Vector2(155.00002, 199) +rotation = 0.8783198 [node name="Boundary" type="StaticBody2D" parent="."] position = Vector2(142, 591) @@ -81,8 +273,5 @@ offset_right = 40.0 offset_bottom = 23.0 text = "0000" -[node name="Bullet" parent="." instance=ExtResource("2_iywne")] -position = Vector2(45, 205.99998) - [connection signal="triggerFiredSignal" from="Trigger" to="." method="_on_trigger_fired"] [connection signal="triggerFiredSignal" from="Trigger2" to="." method="_on_trigger_fired"] diff --git a/scenes/player.tscn b/scenes/player.tscn index e9b5fe2..e55f252 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,9 +1,244 @@ -[gd_scene load_steps=3 format=3 uid="uid://b1yy0sybg66hh"] +[gd_scene load_steps=37 format=3 uid="uid://b1yy0sybg66hh"] [ext_resource type="Script" uid="uid://bpcy1rfota5tu" path="res://scripts/player.gd" id="1_3vyb7"] +[ext_resource type="Texture2D" uid="uid://bb6uc2alre1qu" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_g2els"] +[ext_resource type="Texture2D" uid="uid://dr8leuj7yjpmo" path="res://assets/graphics/player/jumpandfall/player jump 48x48.png" id="2_qhqgy"] +[ext_resource type="Texture2D" uid="uid://gat5giebysdj" path="res://assets/graphics/player/run/player run 48x48.png" id="4_dqkch"] +[ext_resource type="Texture2D" uid="uid://csmss00eyd21r" path="res://assets/graphics/player/shove/Player Punch 64x64.png" id="5_qlg0r"] [sub_resource type="CircleShape2D" id="CircleShape2D_3vyb7"] +[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"] +atlas = ExtResource("2_qhqgy") +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_f1ej7"] +atlas = ExtResource("2_qhqgy") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"] +atlas = ExtResource("2_qhqgy") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"] +atlas = ExtResource("4_dqkch") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"] +atlas = ExtResource("4_dqkch") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"] +atlas = ExtResource("4_dqkch") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"] +atlas = ExtResource("4_dqkch") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"] +atlas = ExtResource("4_dqkch") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"] +atlas = ExtResource("4_dqkch") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"] +atlas = ExtResource("4_dqkch") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"] +atlas = ExtResource("4_dqkch") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_l71n6"] +atlas = ExtResource("5_qlg0r") +region = Rect2(0, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ke2ow"] +atlas = ExtResource("5_qlg0r") +region = Rect2(64, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ujl30"] +atlas = ExtResource("5_qlg0r") +region = Rect2(128, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_31cv2"] +atlas = ExtResource("5_qlg0r") +region = Rect2(192, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pf23h"] +atlas = ExtResource("5_qlg0r") +region = Rect2(256, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dt7fs"] +atlas = ExtResource("5_qlg0r") +region = Rect2(320, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wqfne"] +atlas = ExtResource("5_qlg0r") +region = Rect2(384, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wnwbv"] +atlas = ExtResource("5_qlg0r") +region = Rect2(448, 0, 64, 64) + +[sub_resource type="SpriteFrames" id="SpriteFrames_jej6c"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_jej6c") +}], +"loop": false, +"name": &"fall", +"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_f1ej7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oprun") +}], +"loop": false, +"name": &"jump", +"speed": 12.0 +}, { +"frames": [{ +"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") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i4ail") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_a38lo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4ni07") +}], +"loop": true, +"name": &"run", +"speed": 12.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_l71n6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ke2ow") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ujl30") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_31cv2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pf23h") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dt7fs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wqfne") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wnwbv") +}], +"loop": false, +"name": &"shove", +"speed": 12.0 +}] + [node name="CharacterBody2D" type="CharacterBody2D"] script = ExtResource("1_3vyb7") @@ -12,9 +247,11 @@ shape = SubResource("CircleShape2D_3vyb7") debug_color = Color(0.46210045, 0.5883958, 0.21709043, 0.41960785) [node name="RightCast" type="RayCast2D" parent="."] +scale = Vector2(2.400002, 1) target_position = Vector2(15, 0) [node name="LeftCast" type="RayCast2D" parent="."] +scale = Vector2(2.28, 1) target_position = Vector2(-14, 0) [node name="RightSpawn" type="Marker2D" parent="."] @@ -22,3 +259,22 @@ position = Vector2(15, -10) [node name="LeftSpawn" type="Marker2D" parent="."] position = Vector2(-14, -10) + +[node name="Timer" type="Timer" parent="."] +wait_time = 0.5 +one_shot = true + +[node name="PlayerGraphic" type="AnimatedSprite2D" parent="."] +position = Vector2(1, -3) +scale = Vector2(1, 0.8064177) +sprite_frames = SubResource("SpriteFrames_jej6c") +animation = &"shove" +autoplay = "idle" +frame = 7 +frame_progress = 1.0 + +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2(2, 0) +offset = Vector2(0, -30) + +[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"] diff --git a/scripts/bullet.gd b/scripts/bullet.gd index 0b9a97a..f59eb80 100644 --- a/scripts/bullet.gd +++ b/scripts/bullet.gd @@ -1,6 +1,7 @@ class_name Bullet extends Area2D var speed:float = 700 +@onready var bullet_graphic: Sprite2D = $BulletGraphic # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -13,3 +14,5 @@ func _process(delta: float) -> void: func setSpeed(value)->void: speed = value + if speed<0: + bullet_graphic.flip_h = true diff --git a/scripts/player.gd b/scripts/player.gd index 421a2b9..ea6628c 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -9,6 +9,8 @@ var direction:float = 0 enum FaceDirection{LEFT, RIGHT} var facing:FaceDirection = FaceDirection.RIGHT +enum State{IDLE, JUMP, FALLING, RUNNING, SHOVE} +var current_state:State = State.IDLE @onready var right_cast: RayCast2D = $RightCast @onready var left_cast: RayCast2D = $LeftCast @@ -19,22 +21,64 @@ var pushEnabled:bool = false @onready var right_spawn: Marker2D = $RightSpawn @onready var left_spawn: Marker2D = $LeftSpawn +@export var acceleration:int = 900 +@onready var jump_buffer_timer: Timer = $Timer +@export var hard_gravity:float = 1.5 +var upJump:bool = false + +@onready var player_graphic: AnimatedSprite2D = $PlayerGraphic + func _physics_process(delta: float) -> void: handle_input() handle_movement(delta) + update_states() + update_animation() move_and_slide() handle_collision() - + +func update_states()->void: + # create a state machine + match current_state: + # scenarios + State.JUMP when 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.RUNNING + State.IDLE when velocity.x != 0: + current_state = State.RUNNING + State.RUNNING when velocity.x == 0: + current_state = State.IDLE + +func update_animation()->void: + match current_state: + State.IDLE: + player_graphic.play("idle") + State.JUMP: + if upJump: + player_graphic.play("jump") + State.FALLING: + player_graphic.play("fall") + State.RUNNING: + player_graphic.play("run") + State.SHOVE: + player_graphic.play("shove") + func handle_input()->void: # Handle jump. if Input.is_action_just_pressed("jump") and is_on_floor(): - velocity.y = JUMP_VELOCITY + #velocity.y = JUMP_VELOCITY + jump_buffer_timer.start() direction = Input.get_axis("moveLeft", "moveRight") if direction < 0: facing = FaceDirection.LEFT + player_graphic.flip_h = true if direction > 0: facing = FaceDirection.RIGHT + player_graphic.flip_h = false if Input.is_action_just_pressed("shove") && pushEnabled: print("I want to shove") @@ -44,6 +88,7 @@ func handle_input()->void: shoveDirection = 1 FaceDirection.LEFT: shoveDirection = -1 + current_state = State.SHOVE pushTarget.apply_central_impulse(Vector2(shoveDirection, 0) * 700) if Input.is_action_just_pressed("shoot"): @@ -65,13 +110,22 @@ func handle_input()->void: %SceneManager.makeGrenade(left_spawn.global_transform, -1) func handle_movement(delta)->void: - if direction: - velocity.x = direction * SPEED + if direction == 0: + velocity.x = move_toward(velocity.x, 0, acceleration*delta) else: - velocity.x = move_toward(velocity.x, 0, SPEED) + velocity.x = move_toward(velocity.x, SPEED*direction, acceleration*delta) - if not is_on_floor(): - velocity += get_gravity() * delta + if current_state == State.JUMP: + # normal velocity + velocity += get_gravity()*delta + else: + velocity += get_gravity() * hard_gravity * delta + + if is_on_floor() and jump_buffer_timer.time_left>0: + velocity.y = JUMP_VELOCITY + current_state = State.JUMP + upJump = true + jump_buffer_timer.stop() func handle_collision()->void: # handle world reactions @@ -93,3 +147,14 @@ func handle_collision()->void: if not right_cast.is_colliding() && not left_cast.is_colliding(): pushEnabled = false + + +func _on_animation_finished() -> void: + match current_state: + State.JUMP: + upJump = false + State.SHOVE: + if velocity.x == 0: + current_state = State.IDLE + else: + current_state = State.RUNNING