26 lines
765 B
GDScript
26 lines
765 B
GDScript
extends CharacterBody3D
|
|
|
|
func _ready() -> void:
|
|
if is_multiplayer_authority():
|
|
await get_tree().process_frame
|
|
await get_tree().process_frame
|
|
$Idle.multiplayer_play()
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if is_multiplayer_authority() == false:
|
|
return
|
|
|
|
velocity += get_gravity() * delta / 4
|
|
|
|
|
|
var collision = move_and_collide(velocity * delta)
|
|
if collision:
|
|
if collision.get_normal().y > 0:
|
|
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
|
Session.dynamic_objects_parent.add_child(fire,true)
|
|
fire.global_position = global_position
|
|
queue_free()
|
|
else:
|
|
var normal = collision.get_normal()
|
|
velocity = velocity.bounce(normal) * 0.5
|
|
$MultiplayerAudio3D.multiplayer_play()
|