fixes saving of party monsters, adds display of monster stats in battle ui

This commit is contained in:
Luca 2024-09-29 11:10:46 +02:00
parent 5748d34b34
commit b09eee0805
9 changed files with 201 additions and 61 deletions

View file

@ -10,6 +10,7 @@ var spawn_point: Vector3 = Vector3(0, 0, 0)
@onready var frequency: float = 1.0
@onready var amplitude: float = 0.5
var in_battle: bool = false
var idle: bool = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -28,7 +29,11 @@ func _physics_process(delta: float) -> void:
var x_movement = sin(time * frequency) * amplitude
var y_movement = sin(time * 25) * 4.0
var z_movement = cos(time * frequency) * amplitude
velocity = Vector3(x_movement, y_movement, z_movement)
if not idle:
velocity = Vector3(x_movement, y_movement, z_movement)
else:
velocity = Vector3(0, y_movement, 0)
# if move_and_slide reports collisions
if move_and_slide():
@ -39,15 +44,4 @@ func _physics_process(delta: float) -> void:
if collider.name == "Player":
velocity = Vector3.ZERO
in_battle = true
# calculate players new position
# from the camera 3 units backwards
var camera = collider.find_child("Camera3D")
# local z axis of the camera
var local_z = camera.global_transform.basis.z
var new_player_position = camera.global_transform.origin + local_z * 3
collider.start_battle(self, new_player_position)
#rotate_toward(rotation.z, collider.rotation.z, 1.0)
collider.start_battle(self)