ChronoChamber/Commands/command_block.gd

34 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-08-10 19:26:53 +10:00
#@tool
extends RigidBody3D
class_name Command_Block
@export var command_name : String
2024-08-10 21:26:51 +10:00
@export var command_sprite : Texture2D#:
2024-08-11 12:27:38 +10:00
@export var collider : CollisionShape3D
var spawn_pos : Vector3
2024-08-10 21:26:51 +10:00
#set(new_texture):
#if command_sprite != null:
#command_sprite.changed.disconnect(on_texture_changed)
#command_sprite = new_texture
#command_sprite.changed.connect(on_texture_changed)
2024-08-10 19:26:53 +10:00
# Called when the node enters the scene tree for the first time.
func _ready():
2024-08-10 21:26:51 +10:00
$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate()
2024-08-10 19:26:53 +10:00
$MeshInstance3D.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
2024-08-10 21:26:51 +10:00
#func on_texture_changed():
#print("meow")
#$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate()
#$MeshInstance3D.material_override.albedo_texture = command_sprite