tilemaps spritesheets animated sprites

This commit is contained in:
konzy 2024-12-02 20:49:35 -05:00
parent c1ff1f0a01
commit afce55d54c
19 changed files with 529 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bchghynte2y6e"
path="res://.godot/imported/crate.png-a8589d0a814f9d7cb0facb9c1c1d5fda.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/crate.png"
dest_files=["res://.godot/imported/crate.png-a8589d0a814f9d7cb0facb9c1c1d5fda.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dv6amvxucgy0g"
path="res://.godot/imported/Terrain (32x32).png-8427df30912fbb1ff1afbcce0492e57f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/enviroment/terrain/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-8427df30912fbb1ff1afbcce0492e57f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://da3mdnk0s8bxc"
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/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfmrxvwojl071"
path="res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/jump/player jump 48x48.png"
dest_files=["res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://lk01unajxhx0"
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/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bxiaf5c858g40"
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/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

View File

@ -15,9 +15,18 @@ run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[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] [file_customization]
folder_colors={ folder_colors={
"res://assets/": "yellow",
"res://scripts/": "green" "res://scripts/": "green"
} }

View File

@ -1,13 +1,17 @@
[gd_scene load_steps=2 format=3 uid="uid://flumvyk8tafw"] [gd_scene load_steps=3 format=3 uid="uid://flumvyk8tafw"]
[ext_resource type="Texture2D" uid="uid://bchghynte2y6e" path="res://assets/graphics/crate.png" id="1_4werq"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c58s7"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c58s7"]
size = Vector2(46, 42) size = Vector2(46, 42)
[node name="RigidBody2D" type="RigidBody2D" groups=["box", "shootable"]] [node name="RigidBody2D" type="RigidBody2D" groups=["box", "shootable"]]
position = Vector2(588, 292)
rotation = 0.837162
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_c58s7") shape = SubResource("RectangleShape2D_c58s7")
debug_color = Color(0.816792, 0.399035, 0.20363, 0.42) debug_color = Color(0.816792, 0.399035, 0.20363, 0.42)
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.173255, 0.171077)
texture = ExtResource("1_4werq")

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://e4o5ja1w0gph"] [gd_scene load_steps=4 format=3 uid="uid://e4o5ja1w0gph"]
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_mqe8j"] [ext_resource type="Script" path="res://scripts/bullet.gd" id="1_mqe8j"]
[ext_resource type="Texture2D" uid="uid://bxiaf5c858g40" path="res://assets/graphics/projectiles/pixel_bullet.png" id="2_8q7om"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y4ewo"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_y4ewo"]
size = Vector2(6, 2) size = Vector2(6, 2)
@ -12,4 +13,11 @@ script = ExtResource("1_mqe8j")
shape = SubResource("RectangleShape2D_y4ewo") shape = SubResource("RectangleShape2D_y4ewo")
debug_color = Color(0.341018, 0.620642, 0.0617414, 0.42) debug_color = Color(0.341018, 0.620642, 0.0617414, 0.42)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(-2, -1)
rotation = 3.14159
scale = Vector2(0.062213, 0.0400384)
texture = ExtResource("2_8q7om")
[connection signal="body_entered" from="." to="." method="_on_body_entered"] [connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,9 +1,177 @@
[gd_scene load_steps=3 format=3 uid="uid://b6vk2imhuhv0j"] [gd_scene load_steps=28 format=3 uid="uid://b6vk2imhuhv0j"]
[ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_esbkk"] [ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_esbkk"]
[ext_resource type="Texture2D" uid="uid://da3mdnk0s8bxc" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_jvkyl"]
[ext_resource type="Texture2D" uid="uid://cfmrxvwojl071" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_nnfwu"]
[ext_resource type="Texture2D" uid="uid://lk01unajxhx0" path="res://assets/graphics/player/run/player run 48x48.png" id="3_qml56"]
[sub_resource type="CircleShape2D" id="CircleShape2D_drde1"] [sub_resource type="CircleShape2D" id="CircleShape2D_drde1"]
radius = 23.0 radius = 17.0
[sub_resource type="AtlasTexture" id="AtlasTexture_v6vtg"]
atlas = ExtResource("2_jvkyl")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_r6wh0"]
atlas = ExtResource("2_jvkyl")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_eu1ry"]
atlas = ExtResource("2_jvkyl")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_xh6el"]
atlas = ExtResource("2_jvkyl")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_hmmw7"]
atlas = ExtResource("2_jvkyl")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_s5e0w"]
atlas = ExtResource("2_jvkyl")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ju1ix"]
atlas = ExtResource("2_jvkyl")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wrcia"]
atlas = ExtResource("2_jvkyl")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_feges"]
atlas = ExtResource("2_jvkyl")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_nngfh"]
atlas = ExtResource("2_jvkyl")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_enfrq"]
atlas = ExtResource("3_nnfwu")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_onfup"]
atlas = ExtResource("3_nnfwu")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ir0g5"]
atlas = ExtResource("3_nnfwu")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ui6j2"]
atlas = ExtResource("3_qml56")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_kck86"]
atlas = ExtResource("3_qml56")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ahfj0"]
atlas = ExtResource("3_qml56")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_8r5hg"]
atlas = ExtResource("3_qml56")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qrp3k"]
atlas = ExtResource("3_qml56")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vk50f"]
atlas = ExtResource("3_qml56")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_st2c2"]
atlas = ExtResource("3_qml56")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3pjlk"]
atlas = ExtResource("3_qml56")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_xt5u3"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_v6vtg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r6wh0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eu1ry")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xh6el")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hmmw7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_s5e0w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ju1ix")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wrcia")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_feges")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nngfh")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_enfrq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_onfup")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ir0g5")
}],
"loop": false,
"name": &"jump",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ui6j2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kck86")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ahfj0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8r5hg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qrp3k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vk50f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_st2c2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3pjlk")
}],
"loop": true,
"name": &"run",
"speed": 12.0
}]
[node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]] [node name="CharacterBody2D" type="CharacterBody2D" groups=["player"]]
script = ExtResource("1_esbkk") script = ExtResource("1_esbkk")
@ -15,13 +183,21 @@ shape = SubResource("CircleShape2D_drde1")
debug_color = Color(0.459127, 0.454101, 0.981072, 0.42) debug_color = Color(0.459127, 0.454101, 0.981072, 0.42)
[node name="RightRay" type="RayCast2D" parent="."] [node name="RightRay" type="RayCast2D" parent="."]
target_position = Vector2(36, 0) target_position = Vector2(17, 0)
[node name="LeftRay" type="RayCast2D" parent="."] [node name="LeftRay" type="RayCast2D" parent="."]
target_position = Vector2(-36, 0) target_position = Vector2(-17, 0)
[node name="RightTarget" type="Node2D" parent="."] [node name="RightTarget" type="Node2D" parent="."]
position = Vector2(23, -16) position = Vector2(16, -5)
[node name="LeftTarget" type="Node2D" parent="."] [node name="LeftTarget" type="Node2D" parent="."]
position = Vector2(-23, -16) position = Vector2(-16, -5)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_xt5u3")
animation = &"idle"
autoplay = "idle"
[node name="Camera2D" type="Camera2D" parent="."]

View File

@ -1,11 +1,67 @@
[gd_scene load_steps=9 format=3 uid="uid://dmk3hbsrqhgad"] [gd_scene load_steps=12 format=4 uid="uid://dmk3hbsrqhgad"]
[ext_resource type="Texture2D" uid="uid://dv6amvxucgy0g" path="res://assets/graphics/enviroment/terrain/Terrain (32x32).png" id="1_ab3a4"]
[ext_resource type="PackedScene" uid="uid://flumvyk8tafw" path="res://scenes/box.tscn" id="1_ixp3c"] [ext_resource type="PackedScene" uid="uid://flumvyk8tafw" path="res://scenes/box.tscn" id="1_ixp3c"]
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="1_sylse"] [ext_resource type="Script" path="res://scripts/scene_manager.gd" id="1_sylse"]
[ext_resource type="PackedScene" uid="uid://b6vk2imhuhv0j" path="res://scenes/character.tscn" id="1_umdfo"] [ext_resource type="PackedScene" uid="uid://b6vk2imhuhv0j" path="res://scenes/character.tscn" id="1_umdfo"]
[ext_resource type="Script" path="res://scripts/trigger.gd" id="2_e4xab"] [ext_resource type="Script" path="res://scripts/trigger.gd" id="2_e4xab"]
[ext_resource type="PackedScene" uid="uid://e4o5ja1w0gph" path="res://scenes/bullet.tscn" id="4_7436f"] [ext_resource type="PackedScene" uid="uid://e4o5ja1w0gph" path="res://scenes/bullet.tscn" id="4_7436f"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xdbrn"]
texture = ExtResource("1_ab3a4")
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_g2n8d"]
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_xdbrn")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mhewf"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_mhewf"]
size = Vector2(102, 12) size = Vector2(102, 12)
@ -15,26 +71,49 @@ size = Vector2(102, 12)
[node name="Game" type="Node2D"] [node name="Game" type="Node2D"]
[node name="TileMapLayer" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAQAA4AAAAAAAAAAAARAA4AAAABAAAAAAASAA4AAAABAAAAAAATAA4AAAACAAAAAAAXAA4AAAAAAAQAAAAYAA4AAAABAAQAAAAZAA4AAAABAAQAAAAaAA4AAAACAAQAAAAdAAwAAAAAAAAAAAAdAA0AAAAAAAEAAAAdAA4AAAAAAAIAAAAeAAwAAAABAAAAAAAeAA0AAAABAAEAAAAeAA4AAAABAAIAAAAfAAwAAAACAAAAAAAfAA0AAAACAAEAAAAfAA4AAAACAAIAAAAiAA4AAAAAAAQAAAAjAA4AAAABAAQAAAAkAA4AAAABAAQAAAAlAA4AAAACAAQAAAAoAAwAAAAAAAQAAAApAAwAAAABAAQAAAAqAAwAAAABAAQAAAArAAwAAAACAAQAAAAPABQAAAABAAAAAAAQABQAAAABAAAAAAARABQAAAABAAAAAAAOABQAAAABAAAAAAALABQAAAABAAAAAAAMABQAAAABAAAAAAANABQAAAABAAAAAAAIABQAAAABAAAAAAAJABQAAAABAAAAAAAKABQAAAABAAAAAAAFABQAAAABAAAAAAAGABQAAAABAAAAAAAHABQAAAABAAAAAAACABQAAAABAAAAAAADABQAAAABAAAAAAAEABQAAAABAAAAAAASABQAAAABAAAAAAATABQAAAABAAAAAAAUABQAAAABAAAAAAAVABQAAAABAAAAAAAWABQAAAABAAAAAAAXABQAAAABAAAAAAAYABQAAAABAAAAAAAZABQAAAABAAAAAAAaABQAAAABAAAAAAAbABQAAAABAAAAAAAcABQAAAABAAAAAAAdABQAAAABAAAAAAAeABQAAAABAAAAAAAfABQAAAABAAAAAAAgABQAAAABAAAAAAAhABQAAAABAAAAAAAiABQAAAABAAAAAAAjABQAAAABAAAAAAAkABQAAAABAAAAAAABABQAAAABAAAAAAAAABQAAAABAAAAAAAlABQAAAABAAAAAAAmABQAAAABAAAAAAAnABQAAAABAAAAAAAoABQAAAABAAAAAAApABQAAAABAAAAAAAqABQAAAABAAAAAAArABQAAAABAAAAAAAsABQAAAABAAAAAAAtABQAAAABAAAAAAAuABQAAAABAAAAAAAvABQAAAABAAAAAAAwABQAAAABAAAAAAAxABQAAAABAAAAAAAyABQAAAABAAAAAAAzABQAAAABAAAAAAA0ABQAAAABAAAAAAA1ABQAAAABAAAAAAA2ABQAAAABAAAAAAA3ABQAAAABAAAAAAA4ABQAAAABAAAAAAA=")
tile_set = SubResource("TileSet_g2n8d")
[node name="SceneManager" type="Node" parent="."] [node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
script = ExtResource("1_sylse") script = ExtResource("1_sylse")
[node name="Platform" type="StaticBody2D" parent="."] [node name="Platform" type="StaticBody2D" parent="."]
position = Vector2(584, 454) position = Vector2(576, 455)
scale = Vector2(1.24, 1)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Platform"]
shape = SubResource("RectangleShape2D_mhewf") shape = SubResource("RectangleShape2D_mhewf")
[node name="Platform6" type="StaticBody2D" parent="."]
position = Vector2(1154, 455)
scale = Vector2(1.24, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform6"]
shape = SubResource("RectangleShape2D_mhewf")
[node name="Platform7" type="StaticBody2D" parent="."]
position = Vector2(1343, 391)
scale = Vector2(1.24, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform7"]
shape = SubResource("RectangleShape2D_mhewf")
[node name="Platform2" type="StaticBody2D" parent="."] [node name="Platform2" type="StaticBody2D" parent="."]
position = Vector2(802, 455) position = Vector2(802, 455)
scale = Vector2(1.24, 1)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform2"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Platform2"]
shape = SubResource("RectangleShape2D_mhewf") shape = SubResource("RectangleShape2D_mhewf")
[node name="Platform4" type="StaticBody2D" parent="."] [node name="Platform4" type="StaticBody2D" parent="."]
position = Vector2(980, 381) position = Vector2(976, 391)
scale = Vector2(0.92, 0.945347)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Platform4"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Platform4"]
@ -55,6 +134,7 @@ metadata/_edit_group_ = true
shape = SubResource("RectangleShape2D_mhewf") shape = SubResource("RectangleShape2D_mhewf")
[node name="CharacterBody2D" parent="." instance=ExtResource("1_umdfo")] [node name="CharacterBody2D" parent="." instance=ExtResource("1_umdfo")]
position = Vector2(585, 283)
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
position = Vector2(576, 533) position = Vector2(576, 533)
@ -67,16 +147,16 @@ shape = SubResource("RectangleShape2D_0jo0r")
debug_color = Color(0.774214, 0.233911, 0.917118, 0.42) debug_color = Color(0.774214, 0.233911, 0.917118, 0.42)
[node name="RigidBody2D" parent="." instance=ExtResource("1_ixp3c")] [node name="RigidBody2D" parent="." instance=ExtResource("1_ixp3c")]
position = Vector2(699, 304) position = Vector2(802, 304)
[node name="RigidBody2D2" parent="." instance=ExtResource("1_ixp3c")] [node name="RigidBody2D2" parent="." instance=ExtResource("1_ixp3c")]
position = Vector2(586, 229) position = Vector2(980, 229)
[node name="RigidBody2D3" parent="." instance=ExtResource("1_ixp3c")] [node name="RigidBody2D3" parent="." instance=ExtResource("1_ixp3c")]
position = Vector2(533, 301) position = Vector2(533, 301)
[node name="StaticBody2D" type="StaticBody2D" parent="."] [node name="StaticBody2D" type="StaticBody2D" parent="."]
position = Vector2(581, 648) position = Vector2(581, 642)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]

View File

@ -1,11 +1,18 @@
class_name Bullet extends Area2D class_name Bullet extends Area2D
@onready var bulletSprite: Sprite2D = $Sprite2D
var speed = 750
var speed = 400
# did I hit anyone? # did I hit anyone?
signal hit(bullet, body) signal hit(bullet, body)
func setSpeed(speedValue): func setSpeed(speedValue):
speed = speedValue speed = speedValue
if speed < 0:
bulletSprite.flip_h = true
else:
bulletSprite.flip_h = false
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
position += transform.x * speed * delta position += transform.x * speed * delta

View File

@ -5,14 +5,18 @@ const SPEED = 300.0
const JUMP_VELOCITY = -400.0 const JUMP_VELOCITY = -400.0
const BUMP_FORCE = 50 const BUMP_FORCE = 50
const PUSH_FORCE = 750 const PUSH_FORCE = 750
@onready var right_ray: RayCast2D = $RightRay @onready var right_ray: RayCast2D = $RightRay
@onready var left_ray: RayCast2D = $LeftRay @onready var left_ray: RayCast2D = $LeftRay
@onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D
var faceLeft = false var faceLeft = false
var pushTarget var pushTarget
var pushLeftEnabled = false var pushLeftEnabled = false
var pushRightEnabled = false var pushRightEnabled = false
var isJumping = false
@onready var right_target: Node2D = $RightTarget @onready var right_target: Node2D = $RightTarget
@onready var left_target: Node2D = $LeftTarget @onready var left_target: Node2D = $LeftTarget
@ -43,10 +47,10 @@ func _physics_process(delta: float) -> void:
var mybullet = %SceneManager.bulletFactory() var mybullet = %SceneManager.bulletFactory()
if not faceLeft: if not faceLeft:
mybullet.transform = right_target.global_transform mybullet.transform = right_target.global_transform
mybullet.setSpeed(750) mybullet.setSpeed(400)
if faceLeft: if faceLeft:
mybullet.transform = left_target.global_transform mybullet.transform = left_target.global_transform
mybullet.setSpeed(-750) mybullet.setSpeed(-400)
if direction: if direction:
velocity.x = direction * SPEED velocity.x = direction * SPEED
@ -56,6 +60,24 @@ func _physics_process(delta: float) -> void:
faceLeft = true faceLeft = true
else: else:
velocity.x = move_toward(velocity.x, 0, SPEED) velocity.x = move_toward(velocity.x, 0, SPEED)
if faceLeft:
playerSprite.flip_h = true
else:
playerSprite.flip_h = false
if is_on_floor():
isJumping = false
if direction == 0:
playerSprite.play("idle")
else:
playerSprite.play("run")
else:
if not isJumping:
playerSprite.play("jump")
isJumping = true
move_and_slide() move_and_slide()
if right_ray.is_colliding(): if right_ray.is_colliding():