1
0
mirror of https://gitee.com/freeyz/godot-mota.git synced 2024-12-23 07:19:19 +08:00
godot-mota/scripts/DoorSprite.gd

27 lines
543 B
GDScript3
Raw Normal View History

2020-07-23 15:47:32 +08:00
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)