31 lines
681 B
GDScript
31 lines
681 B
GDScript
tool
|
|
extends Sprite
|
|
|
|
# 楼梯
|
|
class_name StairsSprite
|
|
|
|
enum StairsType { Up,Down }
|
|
|
|
export(StairsType) var stairs_type = StairsType.Up setget set_stairs_type
|
|
|
|
export var player_init_position : Vector2
|
|
|
|
func _init():
|
|
self.texture = load("res://images/mota.png")
|
|
self.region_enabled = true
|
|
|
|
func set_stairs_type(value):
|
|
stairs_type = value
|
|
match value:
|
|
StairsType.Up:
|
|
region_rect = Rect2(96,512,32,32)
|
|
StairsType.Down:
|
|
region_rect = Rect2(64,512,32,32)
|
|
|
|
func _on_Area2D_body_entered(body):
|
|
if stairs_type == StairsType.Up:
|
|
GameFloorManager.call_deferred("load_added_floor")
|
|
if stairs_type == StairsType.Down:
|
|
GameFloorManager.call_deferred("load_reduced_floor")
|
|
|