dash working
This commit is contained in:
parent
cce3f56caa
commit
4b4d97746c
8 changed files with 86 additions and 24 deletions
|
|
@ -14,6 +14,12 @@ signal object_clicked(object : Node3D)
|
|||
var SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
#effects
|
||||
var dash_time = 0
|
||||
@export var dash_node : Node3D
|
||||
var dashing = false
|
||||
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
|
||||
|
|
@ -53,6 +59,7 @@ func _physics_process(delta):
|
|||
held_object.reparent(hand)
|
||||
held_object.position = Vector3(0,0,0)
|
||||
held_object.freeze = true
|
||||
held_object.collider.disabled = true
|
||||
has_object = true
|
||||
elif "placed_command" in raycast.get_collider():
|
||||
# clicked a pedestal, place on pedestal if its not already got something
|
||||
|
|
@ -63,6 +70,7 @@ func _physics_process(delta):
|
|||
held_object.reparent(clicked_pedestal.slot)
|
||||
held_object.position = Vector3(0,0,0)
|
||||
held_object.rotation_degrees = Vector3(0,0,0)
|
||||
held_object.collider.disabled = false
|
||||
has_object = false
|
||||
clicked_pedestal.has_command = true
|
||||
clicked_pedestal.placed_command = held_object
|
||||
|
|
@ -71,6 +79,8 @@ func _physics_process(delta):
|
|||
object_clicked.emit(raycast.get_collider())
|
||||
else:
|
||||
print("womp womp")
|
||||
|
||||
|
||||
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
|
|
@ -84,6 +94,17 @@ func _physics_process(delta):
|
|||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
if (dash_time > 0 ):
|
||||
gravity = 0
|
||||
dash_time -= delta
|
||||
var dash_direction = camera.global_position.direction_to(dash_node.global_position)
|
||||
velocity = dash_direction * SPEED*350 * delta
|
||||
elif dashing:
|
||||
dashing = false
|
||||
velocity = Vector3(0,0,0)
|
||||
gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
pass
|
||||
|
||||
move_and_slide()
|
||||
|
||||
|
||||
|
|
@ -98,6 +119,7 @@ func drop():
|
|||
if has_object:
|
||||
held_object.reparent(get_tree().get_root())
|
||||
held_object.freeze = false
|
||||
held_object.collider.disabled = false
|
||||
has_object = false
|
||||
|
||||
|
||||
|
|
@ -106,8 +128,10 @@ func _on_chrono_manager_broadcast(command):
|
|||
match command:
|
||||
"jump":
|
||||
velocity.y = JUMP_VELOCITY
|
||||
"teleport":
|
||||
pass
|
||||
"dash":
|
||||
#move in looked direction for 0.5 secs
|
||||
dash_time = 0.3
|
||||
dashing = true
|
||||
"run":
|
||||
SPEED = 10
|
||||
"phase":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue