monster spawner and moving to the camera direction
This commit is contained in:
parent
8c29b8bffd
commit
b20f3b5124
821 changed files with 1611 additions and 1409 deletions
|
|
@ -7,6 +7,10 @@ const JUMP_VELOCITY = 4.5
|
|||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
#$CameraRoot.rotation.y += 0.005
|
||||
pass
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
animated_mesh.idle()
|
||||
|
|
@ -23,8 +27,12 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Camera rotation
|
||||
var camera_input_dir := Input.get_vector("joystick_right_left", "joystick_right_right", "joystick_right_left", "joystick_right_right")
|
||||
$CameraRoot.rotation.y += camera_input_dir.x * 0.2
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# Get the input direction and handle the movement / deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
|
||||
|
|
@ -34,6 +42,10 @@ func _physics_process(delta: float) -> void:
|
|||
animated_mesh.fall()
|
||||
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
|
||||
# Rotate the direction with the camera, so that the cameras forward direction
|
||||
# is the joysticks and the players forward direction
|
||||
direction = direction.rotated(Vector3.UP, $CameraRoot.rotation.y)
|
||||
|
||||
# Move character to the direction
|
||||
if direction.length() != 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue