Skip to content

Commit

Permalink
performance upgrades and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
R1cHero committed Jul 27, 2024
1 parent 9d511d8 commit 7831cd9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 53 deletions.
19 changes: 0 additions & 19 deletions scenes/finish.tscn

This file was deleted.

14 changes: 8 additions & 6 deletions scenes/level2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ position = Vector2(552, 1)
[node name="Coin6" parent="Coins" instance=ExtResource("7_5j2nn")]
position = Vector2(552, 150)

[node name="Slimes" type="Node" parent="."]

[node name="Slime" parent="Slimes" instance=ExtResource("8_l6cxp")]
position = Vector2(488, 160)

[node name="Slime2" parent="Slimes" instance=ExtResource("8_l6cxp")]
position = Vector2(775, 160)

[node name="Labels" type="Node" parent="."]

[node name="Label" type="Label" parent="Labels"]
Expand Down Expand Up @@ -585,10 +593,4 @@ collision_mask = 2
position = Vector2(1112, -23)
shape = SubResource("RectangleShape2D_vesyn")

[node name="Slime" parent="." instance=ExtResource("8_l6cxp")]
position = Vector2(488, 160)

[node name="Slime2" parent="." instance=ExtResource("8_l6cxp")]
position = Vector2(775, 160)

[connection signal="body_entered" from="Finish" to="Player" method="_on_change_scene_body_entered"]
16 changes: 2 additions & 14 deletions scenes/level3.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bbwynr6uj2fdw"]
[gd_scene load_steps=11 format=3 uid="uid://bbwynr6uj2fdw"]

[ext_resource type="Script" path="res://scripts/game_manager.gd" id="1_8tnfi"]
[ext_resource type="Texture2D" uid="uid://bcrfccy8xfpky" path="res://assets/sprites/world_tileset.png" id="2_skfhp"]
Expand Down Expand Up @@ -415,9 +415,6 @@ sources/0 = SubResource("TileSetAtlasSource_2r6u8")
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_cib0o"]
distance = -80.0

[sub_resource type="RectangleShape2D" id="RectangleShape2D_cjdwt"]
size = Vector2(14, 14)

[node name="Game" type="Node2D"]

[node name="GameManager" type="Node" parent="."]
Expand Down Expand Up @@ -447,7 +444,7 @@ layer_1/tile_data = PackedInt32Array(65530, 262144, 0, 65531, 262144, 0, 65532,

[node name="Player" parent="." instance=ExtResource("3_2jy7s")]
z_index = 5
position = Vector2(1077, -101)
position = Vector2(1057, -83)

[node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(1, -8)
Expand Down Expand Up @@ -519,12 +516,3 @@ position = Vector2(690, -32)

[node name="Slime7" parent="Slime" instance=ExtResource("7_bsb3u")]
position = Vector2(906, -48)

[node name="Finish" type="Area2D" parent="."]
collision_mask = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="Finish"]
position = Vector2(1112, -23)
shape = SubResource("RectangleShape2D_cjdwt")

[connection signal="body_entered" from="Finish" to="Player" method="_on_finish_body_entered"]
4 changes: 2 additions & 2 deletions scenes/slime.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ shape = SubResource("RectangleShape2D_4isun")
one_way_collision_margin = 0.0

[node name="RayCastRight" type="RayCast2D" parent="."]
position = Vector2(0, -6)
position = Vector2(1, -6)
target_position = Vector2(10, 0)

[node name="RayCastLeft" type="RayCast2D" parent="."]
position = Vector2(0, -6)
position = Vector2(-1, -6)
target_position = Vector2(-10, 0)

[node name="EnemyKill" type="Area2D" parent="."]
Expand Down
14 changes: 3 additions & 11 deletions scripts/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ const JUMP_VELOCITY := -280.0
const GRAVITY := 1000
const FALL_GRAVITY := 1500

# Get the input direction: -1, 0, 1
var direction := Input.get_axis("move_left", "move_right")

@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var jump: AudioStreamPlayer2D = $Jump

Expand All @@ -25,7 +22,7 @@ func _physics_process(delta: float) -> void:
jump.play(0)

# Get the input direction: -1, 0, 1
var direction: int = Input.get_axis("move_left", "move_right")
var direction := Input.get_axis("move_left", "move_right")

# Flip the Sprite
if direction > 0:
Expand Down Expand Up @@ -56,13 +53,8 @@ func get_gravity() -> int:
return GRAVITY
return FALL_GRAVITY

func _on_area_2d_body_entered(body: Node) -> void:
func _on_area_2d_body_entered() -> void:
get_tree().change_scene_to_file("res://scenes/level2.tscn")


func _on_change_scene_body_entered(body: Node) -> void:
func _on_change_scene_body_entered() -> void:
get_tree().change_scene_to_file("res://scenes/level3.tscn")


func _on_finish_body_entered(body: Node) -> void:
get_tree().change_scene_to_file("res://scenes/finish.tscn")
2 changes: 1 addition & 1 deletion scripts/slime.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ func _process(delta: float) -> void:
animated_sprite.flip_h = false
position.x += direction * SPEED * delta

func _on_enemy_kill_body_entered(body: Node) -> void:
func _on_enemy_kill_body_entered() -> void:
#sound_manager.playmobDeathSound()
self.queue_free()

0 comments on commit 7831cd9

Please sign in to comment.