0 votes

Since I'm creating multiple children via code, I can only evaluate the result on the final rendered screen.
I wonder, is there any way to create a grid or other controls to evaluate, for example, if the placement of a child created in the code is correct in the final rendered output?

in Engine by (57 points)

1 Answer

+1 vote

The least code way would be to make a png file with one cell of that grid and then set it to tile in a TextureRect (with import Filter unchecked)

Or with a bunch of code

tool

extends Control

export var bg = Color(1,1,1)
export var fg = Color(0.6,0.5,0.5)
export var rows = 3
export var columns = 3

func _draw():

    var w = rect_size.x
    var h = rect_size.y
    var cw = w/columns #cell width
    var ch = h/rows #cell height

    draw_rect( Rect2(Vector2.ZERO,rect_size), bg)
    for row in range(1,rows, 2):
        var y = ch*row+(ch*0.5)
        draw_line( Vector2(0,y), Vector2(w,y), fg, ch )

    for column in range(1,columns, 2):
        var x = cw*column+(cw*0.5)
        draw_line( Vector2(x,0), Vector2(x,h), fg, cw )
by (905 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.