shadow_sprite.gd 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. @tool
  2. extends Sprite2D
  3. @onready var _forty_five = preload("res://assets/shadow/textures/forty_five.png")
  4. @onready var _isometric = preload("res://assets/shadow/textures/isometric.png")
  5. @onready var _top_down = preload("res://assets/shadow/textures/top_down.png")
  6. @onready var _front_side = preload("res://assets/shadow/textures/front_side.png")
  7. @onready var _oblique_y = preload("res://assets/shadow/textures/oblique_y.png")
  8. @onready var _oblique_z = preload("res://assets/shadow/textures/oblique_z.png")
  9. func _process(_delta):
  10. if not Engine.editor_hint:
  11. if Input.is_action_pressed(&"forty_five_mode"):
  12. set_view_mode(0)
  13. elif Input.is_action_pressed(&"isometric_mode"):
  14. set_view_mode(1)
  15. elif Input.is_action_pressed(&"top_down_mode"):
  16. set_view_mode(2)
  17. elif Input.is_action_pressed(&"front_side_mode"):
  18. set_view_mode(3)
  19. elif Input.is_action_pressed(&"oblique_y_mode"):
  20. set_view_mode(4)
  21. elif Input.is_action_pressed(&"oblique_z_mode"):
  22. set_view_mode(5)
  23. func set_view_mode(view_mode_index):
  24. match view_mode_index:
  25. 0: # 45 Degrees
  26. texture = _forty_five;
  27. 1: # Isometric
  28. texture = _isometric
  29. 2: # Top Down
  30. texture = _top_down
  31. 3: # Front Side
  32. texture = _front_side
  33. 4: # Oblique Y
  34. texture = _oblique_y
  35. 5: # Oblique Z
  36. texture = _oblique_z