Improved the tiling feature (#378)

* Improved tiling feature

* Removed some unwanted code

* Fixed the bug mentioned by overloaded

* Added the requests by overload

* changed the y value which was given x value before
This commit is contained in:
AbhinavKDev 2020-11-13 23:42:20 +05:30 committed by GitHub
parent 4be0740170
commit de4634e22d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 34 deletions

View file

@ -11,6 +11,7 @@ func _ready() -> void:
material.set_shader_param("color2", Global.checker_color_2)
material.set_shader_param("follow_movement", Global.checker_follow_movement)
material.set_shader_param("follow_scale", Global.checker_follow_scale)
_init_position(Global.tile_mode)
func update_offset(offset : Vector2, scale : Vector2) -> void:
@ -20,3 +21,23 @@ func update_offset(offset : Vector2, scale : Vector2) -> void:
func _on_TransparentChecker_resized():
material.set_shader_param("rect_size", rect_size)
func _init_position(id : int):
match id:
0:
Global.tile_mode = Global.Tile_Mode.NONE
Global.transparent_checker.set_size(Global.current_project.size)
Global.transparent_checker.set_position(Vector2.ZERO)
1:
Global.tile_mode = Global.Tile_Mode.BOTH
Global.transparent_checker.set_size(Global.current_project.size*3)
Global.transparent_checker.set_position(-Global.current_project.size)
2:
Global.tile_mode = Global.Tile_Mode.XAXIS
Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*3, Global.current_project.size.y*1))
Global.transparent_checker.set_position(Vector2(-Global.current_project.size.x, 0))
3:
Global.tile_mode = Global.Tile_Mode.YAXIS
Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*1, Global.current_project.size.y*3))
Global.transparent_checker.set_position(Vector2(0, -Global.current_project.size.y))