mirror of
https://gitee.com/freeyz/godot-mota.git
synced 2024-12-23 12:19:18 +08:00
27 lines
543 B
GDScript3
27 lines
543 B
GDScript3
|
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)
|