Skip to content

Commit

Permalink
separate static and obstacles
Browse files Browse the repository at this point in the history
  • Loading branch information
myin142 committed Nov 17, 2023
1 parent 05e41bc commit ceb4b6b
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 15 deletions.
Binary file modified godot/assets/Screen_Start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions godot/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ start={
2d_physics/layer_7="bubble"
2d_physics/layer_8="soft_collision"
2d_physics/layer_9="pick_up"
2d_physics/layer_10="obstacles"

[locale]

Expand Down
6 changes: 6 additions & 0 deletions godot/src/character/PlayerMirrorSprite2D.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
class_name PlayerMirrorSprite2D
extends MirrorSprite2D

@export var player: Player
@export var normal_trident_texture: Texture2D
@export var mirror_trident_texture: Texture2D

func _ready():
player.thrown.connect(update)
GameManager.mirrored.connect(func(_m): update())
update()

func update():
if player.is_thrown():
super.update()
Expand Down
2 changes: 1 addition & 1 deletion godot/src/character/bomb_bullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ radius = 8.0

[node name="BombBullet" type="Area2D" node_paths=PackedStringArray("speed", "collision_shape", "hurt_collision", "raycast", "death_spawner", "hit_box", "health")]
collision_layer = 0
collision_mask = 33
collision_mask = 544
script = ExtResource("1_w8slh")
speed = NodePath("SpeedValue")
max_reflections = 2
Expand Down
2 changes: 1 addition & 1 deletion godot/src/character/enemy_bullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ radius = 5.0

[node name="EnemyBullet" type="Area2D" node_paths=PackedStringArray("speed", "collision_shape", "hurt_collision", "raycast", "death_spawner", "hit_box", "health")]
collision_layer = 0
collision_mask = 33
collision_mask = 544
script = ExtResource("1_m5cyv")
speed = NodePath("SpeedValue")
max_reflections = 2
Expand Down
19 changes: 10 additions & 9 deletions godot/src/character/player_reflection.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://1sccjkvbts1e"]
[gd_scene load_steps=6 format=3 uid="uid://1sccjkvbts1e"]

[ext_resource type="Texture2D" uid="uid://wi47ngkwkxbc" path="res://assets/Gura__Trident_Mirror.png" id="1_awrgi"]
[ext_resource type="Script" path="res://src/character/MirrorSprite2D.gd" id="2_21pk6"]
[ext_resource type="Texture2D" uid="uid://c8x10v1drqabm" path="res://assets/Gura__Normal_Normal.png" id="1_m2o5t"]
[ext_resource type="Texture2D" uid="uid://co8dko7iojh8p" path="res://assets/Gura__Trident_Normal.png" id="3_4mtbe"]
[ext_resource type="Script" path="res://src/character/PlayerMirrorSprite2D.gd" id="4_j7uc5"]
[ext_resource type="Texture2D" uid="uid://6lcoatpub83l" path="res://assets/Gura__Normal_Mirror.png" id="5_h6dwk"]

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

[node name="MirrorSprite2D" type="Sprite2D" parent="."]
position = Vector2(3, -2)
texture = ExtResource("1_awrgi")
[node name="PlayerMirrorSprite2D" type="Sprite2D"]
texture = ExtResource("5_h6dwk")
hframes = 4
script = ExtResource("2_21pk6")
mirror_texture = ExtResource("3_4mtbe")
script = ExtResource("4_j7uc5")
normal_trident_texture = ExtResource("1_awrgi")
mirror_trident_texture = ExtResource("3_4mtbe")
mirror_texture = ExtResource("1_m2o5t")
2 changes: 1 addition & 1 deletion godot/src/character/trident.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ size = Vector2(8, 12)

[node name="Trident" type="Area2D" node_paths=PackedStringArray("speed", "collision_shape", "raycast", "hit_box")]
collision_layer = 0
collision_mask = 33
collision_mask = 544
script = ExtResource("1_uombx")
speed = NodePath("SpeedValue")
disable_initial_hit = false
Expand Down
3 changes: 2 additions & 1 deletion godot/src/game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ render_target_update_mode = 4
visible = false
position_smoothing_enabled = true

[node name="PlayerReflection" parent="MirrorViewport" instance=ExtResource("6_bcrcl")]
[node name="PlayerReflection" parent="MirrorViewport" node_paths=PackedStringArray("player") instance=ExtResource("6_bcrcl")]
player = NodePath("../../Player")

[connection signal="died" from="Player" to="." method="_on_player_died"]
[connection signal="reflected" from="Player" to="." method="_on_player_reflected"]
3 changes: 2 additions & 1 deletion godot/src/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends CharacterBody2D

signal died()
signal reflected()
signal thrown()

@export var dash_force := 500
@export var dash_deaccel := 1500
Expand Down Expand Up @@ -36,7 +37,7 @@ func get_hp_percentage():
return hp_bar.get_health_percent()

func _update_throw():
sprite.update()
thrown.emit()

func _on_just_pressed(ev: InputEvent):
if ev.is_action_pressed("dash") and not dashing:
Expand Down
1 change: 0 additions & 1 deletion godot/src/props/door.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ texture = ExtResource("2_wnn8d")
hframes = 5

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0, 0.5)
shape = SubResource("RectangleShape2D_lth1k")

Expand Down
1 change: 1 addition & 0 deletions godot/src/props/stone.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ position = Vector2(-82, 29)
radius = 5.0

[node name="Stone" type="StaticBody2D" parent="."]
collision_layer = 513
collision_mask = 0

[node name="Sprite2D" type="Sprite2D" parent="Stone"]
Expand Down

0 comments on commit ceb4b6b

Please sign in to comment.