Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jbko6 |
I’m having an issue using the function set_cell(). I have a function that draws boxes using a two for loops but there’s an issue when trying to call that function twice in the same function.
if Input.is_action_pressed("ui_focus_next"):
#Draws a large box
drawBox(0,0,10,10,1)
var PPos = get_node("/root/Node2D/Player").get_position().floor()
#Must draw a walkable box where the character is
print(PPos.x,",",PPos.y)
drawBox(PPos.x,PPos.y,4,4,0)
For reference, the function I’m using to draw the box is put together like so:
drawBox(X, Y, Width, Height, TileID)
When the script shown above runs it should create a 10 by 10 box of tile id 1, and then a smaller box of tile id 0 where the player is. However, when I run it, it only creates the 10 by 10 box and not the smaller box where the player is.
I’ve tried adding a yield argument because at first I though it was because of multi-threading, but that didn’t work and now I’m not sure.
Sorry if this question is messy, this is my first project in Godot!
I don’t think yield
will help, also there is no multi-threading involved here anyways.
Can you show the code of drawBox
?
Zylann | 2019-09-16 12:59