diff --git a/maps/level1.tscn b/maps/level1.tscn index bc631eb..0eaf43e 100644 --- a/maps/level1.tscn +++ b/maps/level1.tscn @@ -21,4 +21,18 @@ format = 2 layer_0/tile_data = PackedInt32Array(720896, 0, 0, 720897, 0, 0, 720898, 0, 0, 720899, 0, 0, 720900, 0, 0, 720901, 0, 0, 720902, 0, 0, 720903, 0, 0, 720904, 0, 0, 720905, 0, 0, 720906, 0, 0, 720907, 0, 0, 720908, 0, 0, 720909, 0, 0, 720910, 0, 0, 720911, 0, 0, 720912, 0, 0, 720913, 0, 0) [node name="Spring" parent="." instance=ExtResource("4_a3xei")] -position = Vector2(144, 176) +position = Vector2(88, 176) + +[node name="Spring2" parent="." instance=ExtResource("4_a3xei")] +position = Vector2(120, 176) + +[node name="Spring3" parent="." instance=ExtResource("4_a3xei")] +position = Vector2(152, 176) + +[node name="Spring4" parent="." instance=ExtResource("4_a3xei")] +position = Vector2(104, 120) +rotation = 3.14159 + +[node name="Spring5" parent="." instance=ExtResource("4_a3xei")] +position = Vector2(136, 120) +rotation = 3.14159 diff --git a/objects/player/player.tscn b/objects/player/player.tscn index 4d4bfc8..957bfa8 100644 --- a/objects/player/player.tscn +++ b/objects/player/player.tscn @@ -49,9 +49,9 @@ expression = "player.velocity.y >= 0.0" [node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics")] floor_snap_length = 3.0 script = ExtResource("1_jgave") -gravity = 200.0 -run_speed = 64.0 -jump_force = 120.0 +gravity = 400.0 +run_speed = 76.0 +jump_force = 150.0 state_chart = NodePath("StateChart") graphics = NodePath("Graphics") diff --git a/objects/spring/spring.gd b/objects/spring/spring.gd index 8be72a7..83e4139 100644 --- a/objects/spring/spring.gd +++ b/objects/spring/spring.gd @@ -14,5 +14,9 @@ func _process(delta: float) -> void: func _on_area_2d_body_entered(body: Node2D) -> void: if body is Player: - body.velocity.y = -bounce_power + if body.velocity.y == 0: + body.velocity.x = (body.jump_force * 1.5) * sign(-body.velocity.x) + else: + body.velocity.y = (body.jump_force * 1.5) * sign(-body.velocity.y) + body.velocity.x += body.graphics.scale.x * 20.0 %AnimationPlayer.play("bounce") diff --git a/objects/spring/spring.tscn b/objects/spring/spring.tscn index 5b26ab0..eded036 100644 --- a/objects/spring/spring.tscn +++ b/objects/spring/spring.tscn @@ -3,6 +3,21 @@ [ext_resource type="Script" path="res://objects/spring/spring.gd" id="1_05bif"] [ext_resource type="Texture2D" uid="uid://bobpl8pwm216q" path="res://assets/textures/spring/spring.png" id="1_s1olr"] +[sub_resource type="Animation" id="Animation_pa4d8"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} + [sub_resource type="Animation" id="Animation_8kq4q"] resource_name = "bounce" length = 0.3 @@ -19,21 +34,6 @@ tracks/0/keys = { "values": [1, 2, 3, 2, 0] } -[sub_resource type="Animation" id="Animation_pa4d8"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [0] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_2p5yk"] _data = { "RESET": SubResource("Animation_pa4d8"),