30 lines
909 B
GDScript
30 lines
909 B
GDScript
@tool
|
|
extends RigidBody3D
|
|
class_name Command_Block
|
|
|
|
#TODO make this all an enum
|
|
@export var command_name : String
|
|
|
|
@export var command_sprite : Texture2D:
|
|
set(new_texture):
|
|
command_sprite = new_texture
|
|
mesh.material_override = mesh.material_override.duplicate()
|
|
mesh.material_override.albedo_texture = command_sprite
|
|
@export var mesh : MeshInstance3D
|
|
@export var collider : CollisionShape3D
|
|
var spawn_pos : Vector3
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
mesh = $MeshInstance3D
|
|
mesh.material_override = mesh.material_override.duplicate()
|
|
mesh.material_override.albedo_texture = command_sprite
|
|
spawn_pos = global_position
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
if(global_position.y < -25):
|
|
global_position = spawn_pos
|
|
linear_velocity = Vector3(0,0,0)
|
|
pass
|