This commit is contained in:
2024-10-25 17:48:21 +02:00
parent ab6acac55b
commit 5dc5c305e3
7 changed files with 144 additions and 38 deletions

View File

@ -105,7 +105,7 @@ script = ExtResource("1_y3u7o")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_gwbt3")
autoplay = "default"
frame_progress = 0.985627
frame_progress = 0.446115
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_xb7vb")

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=12 format=4 uid="uid://ddx678te8glnm"]
[gd_scene load_steps=13 format=4 uid="uid://ddx678te8glnm"]
[ext_resource type="PackedScene" uid="uid://cxdkngh6fo5p7" path="res://scenes/player.tscn" id="1_866nb"]
[ext_resource type="Texture2D" uid="uid://dcqrtadm8khs6" path="res://assets/sprites/world_tileset.png" id="2_xrfdw"]
[ext_resource type="PackedScene" uid="uid://c54bhvh3awmhl" path="res://scenes/platform.tscn" id="3_3twsu"]
[ext_resource type="PackedScene" uid="uid://dbjp33ljlh1vh" path="res://scenes/coin.tscn" id="4_ydnys"]
[ext_resource type="PackedScene" uid="uid://cxkr1ot3mkts1" path="res://scenes/killzone.tscn" id="5_sa1lr"]
[ext_resource type="PackedScene" uid="uid://btfpng5d31b83" path="res://scenes/slime.tscn" id="6_solsf"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gsgsl"]
texture = ExtResource("2_xrfdw")
@ -172,6 +173,21 @@ texture = ExtResource("2_xrfdw")
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_gsgsl")
[sub_resource type="Animation" id="Animation_wtr4d"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-56, -89)]
}
[sub_resource type="Animation" id="Animation_8gab2"]
resource_name = "move"
length = 3.0
@ -189,21 +205,6 @@ tracks/0/keys = {
"values": [Vector2(-56, -89), Vector2(-252, -89)]
}
[sub_resource type="Animation" id="Animation_wtr4d"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-56, -89)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_38isg"]
_data = {
"RESET": SubResource("Animation_wtr4d"),
@ -221,18 +222,21 @@ position = Vector2(-12, -59)
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_tqw72")
format = 2
layer_0/name = "Mid"
layer_0/tile_data = PackedInt32Array(262175, 327680, 9, 262176, 327680, 9, 262177, 327680, 9, 262178, 327680, 9, 196638, 327680, 0, 262174, 327680, 0, 262173, 327680, 0, 196637, 327680, 0, 327709, 327680, 0, 327710, 327680, 0, 327711, 327680, 0, 327712, 327680, 0, 327713, 327680, 0, 327714, 327680, 0, 327715, 327680, 0, 262179, 327680, 9, 262180, 327680, 9, 262181, 327680, 9, 262182, 327680, 9, 262183, 327680, 9, 262184, 327680, 9, 262185, 327680, 9, 262186, 327680, 9, 262187, 327680, 9, 262188, 327680, 9, 262189, 327680, 9, 327716, 327680, 0, 327717, 327680, 0, 327718, 327680, 0, 327719, 327680, 0, 327720, 327680, 0, 327721, 327680, 0, 327722, 327680, 0, 327723, 327680, 0, 327724, 327680, 0, 327725, 327680, 0, 196654, 262144, 0, 131119, 262144, 0, 65584, 262144, 0, 50, 262144, 0, 262190, 327680, 0, 196655, 327680, 0, 131120, 327680, 0, 65586, 327680, 0, 51, 327680, 0, 65587, 327680, 0, 65588, 327680, 0, 52, 327680, 0, 53, 327680, 0, 65589, 327680, 0, -65485, 262144, 0, -65484, 262144, 0, -65483, 262144, 0, -65482, 262144, 0, 54, 327680, 0, 65590, 131072, 1, -131019, 327680, 5, -196555, 327680, 4, -262091, 327680, 4, -327627, 327680, 4, -393163, 327680, 3, 65583, 327680, 6, -131020, 327680, 6, -131021, 327680, 7, -131018, 327680, 7, -65481, 131072, 0, -65480, 131072, 0, -65479, 131072, 0, -65476, 131072, 0, -65474, 131072, 0, -65473, 131072, 0, -65472, 131072, 0, 55, 131072, 1, 56, 131072, 1, 57, 131072, 1, 65593, 131072, 1, 65592, 131072, 1, 65591, 131072, 1, 60, 131072, 1, 65596, 131072, 1, 62, 131072, 1, 63, 131072, 1, 64, 131072, 1, 65600, 131072, 1, 65599, 131072, 1, 65598, 131072, 1, -131012, 393216, 5, -196548, 393216, 4, -262084, 393216, 4, -327620, 393216, 4, -393156, 393216, 3, -131009, 393216, 5, -131008, 393216, 5, -131007, 393216, 5, -131006, 393216, 5, -131005, 393216, 5, -131004, 393216, 5, -131003, 393216, 5, -131002, 393216, 5, -131001, 393216, 5, -196545, 393216, 4, -196544, 393216, 4, -196543, 393216, 4, -196542, 393216, 4, -196541, 393216, 4, -196540, 393216, 4, -196539, 393216, 4, -196538, 393216, 4, -196537, 393216, 4, -262073, 393216, 4, -262074, 393216, 4, -262075, 393216, 4, -262076, 393216, 4, -262077, 393216, 4, -262078, 393216, 4, -262079, 393216, 4, -262080, 393216, 4, -262081, 393216, 4, -327617, 393216, 4, -327615, 393216, 4, -327614, 393216, 4, -393150, 393216, 4, -327612, 393216, 4, -393148, 393216, 4, -458684, 393216, 4, -327613, 393216, 4, -327611, 393216, 4, -327610, 393216, 4, -393147, 393216, 4, -524220, 393216, 4, -393151, 393216, 4, -393153, 393216, 4, -458692, 393216, 3, -458689, 393216, 3, -327616, 393216, 3, -458687, 393216, 3, -458686, 393216, 3, -393149, 393216, 3, -589756, 393216, 3, -458683, 393216, 3, -393146, 393216, 3, -327609, 393216, 3, -65471, 131072, 0, -65470, 131072, 0, -65469, 131072, 0, -65468, 131072, 0, -65467, 131072, 0, -65466, 131072, 0, -65465, 131072, 0, 65, 131072, 1, 66, 131072, 1, 67, 131072, 1, 68, 131072, 1, 69, 131072, 1, 70, 131072, 1, 71, 131072, 1, 72, 131072, 1, 65601, 131072, 1, 65602, 131072, 1, 65603, 131072, 1, 65604, 131072, 1, 65605, 131072, 1, 65606, 131072, 1, 65607, 131072, 1, -65464, 131072, 0, 65608, 131072, 1, -131000, 524288, 3, -65461, 131072, 0, -65458, 131072, 0, -65457, 131072, 0, -65456, 131072, 0, -130989, 131072, 0, -196521, 131072, 0, -196520, 131072, 0, 75, 131072, 1, 65611, 131072, 1, 78, 131072, 1, 79, 131072, 1, 80, 131072, 1, 65616, 131072, 1, 65615, 131072, 1, 65614, 131072, 1, -65453, 131072, 1, 83, 131072, 1, 65619, 131072, 1, -130985, 131072, 1, -65449, 131072, 1, 87, 131072, 1, 65623, 131072, 1, -130984, 131072, 1, -65448, 131072, 1, 88, 131072, 1, 65624, 131072, 1, -196519, 131072, 2, -196518, 131072, 2, -196517, 131072, 2, -196516, 131072, 2, -196514, 131072, 2, -196515, 131072, 2, -262054, 131072, 8, -327590, 131072, 8, -393126, 131072, 8, -262050, 131072, 8, -327586, 131072, 8, -393122, 131072, 8, -458662, 589824, 3, -458661, 589824, 3, -458660, 589824, 3, -458659, 589824, 3, -458658, 589824, 3, -393125, 589824, 3, -393123, 589824, 3, -393127, 589824, 3, -393121, 589824, 3, -524197, 131072, 8, -524196, 131072, 8, -524195, 131072, 8, -589732, 131072, 8, -130983, 131072, 1, -65447, 131072, 1, 89, 131072, 1, 65625, 131072, 1, -130982, 131072, 1, -65446, 131072, 1, 90, 131072, 1, 65626, 131072, 1, -130981, 131072, 1, -65445, 131072, 1, 91, 131072, 1, 65627, 131072, 1, -130980, 131072, 1, -65444, 131072, 1, 92, 131072, 1, 65628, 131072, 1, -130979, 131072, 1, -65443, 131072, 1, 93, 131072, 1, 65629, 131072, 1, -130978, 131072, 1, -65442, 131072, 1, 94, 131072, 1, 65630, 131072, 1)
[node name="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Pz/AAAEAAAAAAAZAP3/AAAFAAAAAAAaAP3/AAAFAAAAAAAbAP3/AAAFAAAAAAAcAP3/AAAFAAAAAAAeAP3/AAAFAAAAAAAdAP3/AAAFAAAAAAAZAP7/AAAFAAAAAAAaAP7/AAAFAAAAAAAaAP//AAAFAAAAAAAbAP//AAAFAAAAAAAbAAAAAAAFAAAAAAAcAAAAAAAFAAAAAAAcAAEAAAAFAAAAAAAdAAEAAAAFAAAAAAAdAAIAAAAFAAAAAAAeAAIAAAAFAAAAAAAcAAIAAAAFAAAAAAAbAAIAAAAFAAAAAAAaAAIAAAAFAAAAAAAZAAIAAAAFAAAAAAAZAAEAAAAFAAAAAAAZAAAAAAAFAAAAAAAZAP//AAAFAAAAAAAaAAEAAAAFAAAAAAAbAAEAAAAFAAAAAAAaAAAAAAAFAAAAAAAbAP7/AAAFAAAAAAAcAP7/AAAFAAAAAAAdAP7/AAAFAAAAAAAeAP7/AAAFAAAAAAAeAP//AAAFAAAAAAAeAAAAAAAFAAAAAAAeAAEAAAAFAAAAAAAdAAAAAAAFAAAAAAAdAP//AAAFAAAAAAAcAP//AAAFAAAAAAAbAPv/AAABAAcAAAAcAPv/AAAFAAUAAAAcAPr/AAAFAAQAAAAcAPn/AAAFAAQAAAAcAPj/AAAFAAQAAAAcAPf/AAAFAAQAAAAcAPb/AAAFAAMAAAAeAPv/AAAIAAMAAAAGAAAAAAAIAAMAAAAEAPv/AAAIAAMAAAA=")
tile_set = SubResource("TileSet_tqw72")
y_sort_origin = 1
[node name="Player" parent="." instance=ExtResource("1_866nb")]
z_index = 5
position = Vector2(-104, 30)
[node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(55, -19)
position = Vector2(64, -36)
zoom = Vector2(4, 4)
limit_bottom = 120
position_smoothing_enabled = true
@ -246,26 +250,43 @@ libraries = {
}
autoplay = "move"
[node name="Coin" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(-259, -101)
[node name="Coin2" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(153, -73)
[node name="Coin3" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(168, 6)
[node name="Coin4" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(312, -8)
[node name="Coin5" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(344, -121)
[node name="Coin6" parent="." instance=ExtResource("4_ydnys")]
position = Vector2(-40, 8)
[node name="killzone" parent="." instance=ExtResource("5_sa1lr")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="killzone"]
position = Vector2(-6, 94)
shape = SubResource("WorldBoundaryShape2D_ewejv")
[node name="Coins" type="Node" parent="."]
[node name="Coin" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(-259, -101)
[node name="Coin2" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(153, -73)
[node name="Coin3" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(168, 6)
[node name="Coin4" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(312, -8)
[node name="Coin5" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(344, -121)
[node name="Coin6" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(-40, 8)
[node name="Coin7" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(524, 66)
[node name="Coin8" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(744, 41)
[node name="Coin9" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(1424, -61)
[node name="Coin10" parent="Coins" instance=ExtResource("4_ydnys")]
position = Vector2(1288, -24)
[node name="slime" parent="." instance=ExtResource("6_solsf")]
position = Vector2(556, 68)

View File

@ -7,6 +7,7 @@ collision_mask = 2
script = ExtResource("1_dutdq")
[node name="Timer" type="Timer" parent="."]
wait_time = 0.254
one_shot = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -51,7 +51,7 @@ position = Vector2(0, -12)
sprite_frames = SubResource("SpriteFrames_j6wpo")
animation = &"idle"
autoplay = "idle"
frame_progress = 0.179935
frame_progress = 0.414056
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -6)

66
scenes/slime.tscn Normal file
View File

@ -0,0 +1,66 @@
[gd_scene load_steps=10 format=3 uid="uid://btfpng5d31b83"]
[ext_resource type="Script" path="res://scripts/slime.gd" id="1_kj13p"]
[ext_resource type="Texture2D" uid="uid://dbwh17otsbga4" path="res://assets/sprites/slime_green.png" id="1_x3p18"]
[ext_resource type="PackedScene" uid="uid://cxkr1ot3mkts1" path="res://scenes/killzone.tscn" id="2_7kal0"]
[sub_resource type="AtlasTexture" id="AtlasTexture_g5y6v"]
atlas = ExtResource("1_x3p18")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_u86q0"]
atlas = ExtResource("1_x3p18")
region = Rect2(24, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_xqlso"]
atlas = ExtResource("1_x3p18")
region = Rect2(48, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_6mhlf"]
atlas = ExtResource("1_x3p18")
region = Rect2(72, 0, 24, 24)
[sub_resource type="SpriteFrames" id="SpriteFrames_oo5qv"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_g5y6v")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_u86q0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xqlso")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6mhlf")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uy1yv"]
size = Vector2(11, 8)
[node name="Node2D" type="Node2D"]
script = ExtResource("1_kj13p")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_oo5qv")
autoplay = "default"
frame_progress = 0.720463
[node name="killzone" parent="." instance=ExtResource("2_7kal0")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="killzone"]
position = Vector2(0, 8)
shape = SubResource("RectangleShape2D_uy1yv")
[node name="RayCastRight" type="RayCast2D" parent="."]
position = Vector2(-1, 7)
target_position = Vector2(11, 0)
[node name="RayCastLeft" type="RayCast2D" parent="."]
position = Vector2(-1, 7)
target_position = Vector2(-8, 0)

View File

@ -11,7 +11,7 @@ func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
if (Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("ui_up")) and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.

18
scripts/slime.gd Normal file
View File

@ -0,0 +1,18 @@
extends Node2D
@onready var ray_cast_right: RayCast2D = $RayCastRight
@onready var ray_cast_left: RayCast2D = $RayCastLeft
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
const speed = 60
var direction = 1
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if ray_cast_right.is_colliding():
direction = -1
animated_sprite_2d.flip_h = true
elif ray_cast_left.is_colliding():
direction = 1
animated_sprite_2d.flip_h = false
position.x += delta * speed * direction