diff --git a/src/actors/player/FireBall.gd b/src/actors/player/FireBall.gd index ca538c90a5cc84a837e201f8851826474cec5712..e88a9e8544dd11475eaf29ee29c604f7f4ca1dde 100755 --- a/src/actors/player/FireBall.gd +++ b/src/actors/player/FireBall.gd @@ -26,3 +26,11 @@ func _on_Area2D_body_entered(body : Node): queue_free() #print("collided with " + str(body.name) + " - " + str(body.get_class()) + " - " + str(body.get_groups())) +func set_direction(dir: Vector2): + direction = dir + print(dir) + if dir.x < 0: + print("flip") + $Sprite.flip_v = true + $Sprite.offset.y = 25 + diff --git a/src/actors/player/FireBall.tscn b/src/actors/player/FireBall.tscn index d00b37871a28464714cc6d5dd27b499ba0fedd96..3d887615c84be9117fb946805f6241c9df82c185 100755 --- a/src/actors/player/FireBall.tscn +++ b/src/actors/player/FireBall.tscn @@ -12,7 +12,7 @@ collision_mask = 24 script = ExtResource( 1 ) [node name="Sprite" type="Sprite" parent="."] -position = Vector2( 0, -18 ) +position = Vector2( -12, -18 ) rotation = -1.57079 texture = ExtResource( 2 ) @@ -21,7 +21,7 @@ collision_layer = 5 collision_mask = 24 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2( 12, -18 ) +position = Vector2( 0, -18 ) shape = SubResource( 2 ) [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] diff --git a/src/actors/player/Player.gd b/src/actors/player/Player.gd index 2b2c2571ce71737d4e1fa13a28f5f8799da5c852..a9d4532aa36662922d0dd9914797565bb93ff6f1 100755 --- a/src/actors/player/Player.gd +++ b/src/actors/player/Player.gd @@ -211,7 +211,7 @@ func attack_process(): if attack_state == ATTACK_STATES.RANGED: var b = FireBall.instance() b.position = self.position - b.direction = self.last_look_direction + b.set_direction(self.last_look_direction) get_tree().current_scene.add_child(b) if attack_state == ATTACK_STATES.MELEE: print("melee")