made a rat and a ladder and the rat is *kind* of working
This commit is contained in:
27
scripts/rat.gd
Normal file
27
scripts/rat.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@onready var anim_player = $AnimationPlayer
|
||||
@export var dead_rat : Resource
|
||||
var end_hole
|
||||
var control_node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if end_hole != null:
|
||||
var move_direction = end_hole.global_position - self.position
|
||||
self.set_linear_velocity(move_direction * 1)
|
||||
#self.look_at(end_hole.position,Vector3.UP)
|
||||
|
||||
func breaking(bullet_velocity):
|
||||
var spawn_broken = dead_rat.instantiate()
|
||||
spawn_broken.position = global_position
|
||||
spawn_broken.transform.basis = global_transform.basis
|
||||
spawn_broken.rotation = rotation
|
||||
var pieces = spawn_broken.get_children()
|
||||
get_tree().get_root().add_child(spawn_broken)
|
||||
queue_free()
|
||||
Reference in New Issue
Block a user