Handiling tile modes in each project (#388)

* Handiling tile modes in each project

Co-authored-by: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com>
This commit is contained in:
AbhinavKDev 2020-11-24 22:23:18 +05:30 committed by GitHub
parent d7008362b5
commit 96454a2d57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View file

@ -20,7 +20,7 @@ func _draw() -> void:
for i in range(Global.current_project.layers.size()):
var modulate_color := Color(1, 1, 1, current_cels[i].opacity - tilemode_opacity)
if Global.current_project.layers[i].visible: # if it's visible
if Global.tile_mode:
if Global.current_project.tile_mode:
for pos in positions:
draw_texture(current_cels[i].image_texture, pos, modulate_color)
@ -28,7 +28,7 @@ func _draw() -> void:
func get_tile_positions(size):
match Global.tile_mode:
match Global.current_project.tile_mode:
1:
return [
Vector2(location.x, location.y + size.y), # Down

View file

@ -11,7 +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)
_init_position(Global.current_project.tile_mode)
func update_offset(offset : Vector2, scale : Vector2) -> void:
@ -26,18 +26,18 @@ func _on_TransparentChecker_resized():
func _init_position(id : int):
match id:
0:
Global.tile_mode = Global.Tile_Mode.NONE
Global.current_project.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.current_project.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.current_project.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.current_project.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))