mirror of
https://gitee.com/freeyz/godot-mota.git
synced 2024-12-23 00:59:20 +08:00
27 lines
543 B
GDScript
27 lines
543 B
GDScript
tool
|
|
extends Sprite
|
|
|
|
class_name DoorSprite
|
|
|
|
# 门类型
|
|
enum DoorType { Yellow,Blue,Red,Iron }
|
|
|
|
export(DoorType) var door_type setget set_door_type
|
|
|
|
# 默认数据初始化
|
|
func _init():
|
|
self.texture = load("res://images/mota.png")
|
|
self.region_enabled = true
|
|
|
|
func set_door_type(value):
|
|
door_type = value
|
|
match value:
|
|
DoorType.Yellow:
|
|
region_rect = Rect2(192,480,32,32)
|
|
DoorType.Blue:
|
|
region_rect = Rect2(224,480,32,32)
|
|
DoorType.Red:
|
|
region_rect = Rect2(256,480,32,32)
|
|
DoorType.Iron:
|
|
region_rect = Rect2(288,480,32,32)
|