ChronoChamber/Commands/command_block.gd

31 lines
909 B
GDScript3
Raw Permalink Normal View History

2024-08-12 00:10:55 +10:00
@tool
2024-08-10 19:26:53 +10:00
extends RigidBody3D
class_name Command_Block
2024-08-12 00:10:55 +10:00
#TODO make this all an enum
2024-08-10 19:26:53 +10:00
@export var command_name : String
2024-08-13 22:45:09 +10:00
2024-08-12 00:10:55 +10:00
@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
2024-08-13 22:45:09 +10:00
@export var mesh : MeshInstance3D
2024-08-11 12:27:38 +10:00
@export var collider : CollisionShape3D
var spawn_pos : Vector3
2024-08-10 19:26:53 +10:00
# Called when the node enters the scene tree for the first time.
func _ready():
2024-08-13 22:45:09 +10:00
mesh = $MeshInstance3D
2024-08-12 00:10:55 +10:00
mesh.material_override = mesh.material_override.duplicate()
mesh.material_override.albedo_texture = command_sprite
spawn_pos = global_position
2024-08-10 19:26:53 +10:00
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)
2024-08-10 19:26:53 +10:00
pass