Initial commit
This commit is contained in:
32
Items/interactables.gd
Normal file
32
Items/interactables.gd
Normal file
@@ -0,0 +1,32 @@
|
||||
extends TileMap
|
||||
|
||||
var timer = false
|
||||
var animate_forwards = true
|
||||
|
||||
func _ready():
|
||||
# Spawn new light for all tablets
|
||||
for cell in get_used_cells_by_id(0):
|
||||
var wifi = load("res://Items/Wifi/Wifi.tscn").instance() as Node2D
|
||||
var center = Vector2(8, 8) + cell * 16
|
||||
wifi.position = center
|
||||
add_child(wifi)
|
||||
|
||||
func _process(delta):
|
||||
if timer:
|
||||
for cell in get_used_cells_by_id(0):
|
||||
var tile = get_cell_autotile_coord(cell.x, cell.y)
|
||||
if int(tile.x + 1) % 3 == 0 and animate_forwards:
|
||||
animate_forwards = false
|
||||
if int(tile.x) % 3 == 0 and !animate_forwards:
|
||||
animate_forwards = true
|
||||
|
||||
if animate_forwards:
|
||||
set_cell(cell.x, cell.y, 0, false, false, false, Vector2(tile.x+1, tile.y))
|
||||
else:
|
||||
set_cell(cell.x, cell.y, 0, false, false, false, Vector2(tile.x-1, tile.y))
|
||||
timer = false
|
||||
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
timer = true
|
||||
Reference in New Issue
Block a user