0 votes

Original Question (for new situation see below edit):

Hello everyone

sorry if this problem is asked already but im doing a gamejam right now
and have not so much time to research but the 45min of google and this site
didnt turn up an answer.

so im trying to recreate a chessboard programatically adding the seperate spaces
to a node2d field.

my window settings in projektsettings is 720-720
the textures of my individual spaces (im using animated sprite node to change between
black and white texture) are both 90-90 so it should perfectly fill out the view in
a 8x8 grid, but it doesnt

setup code looks like this:

func _fieldSetup():
    for i in range(1,9):
        for j in range(1,9):
            var space = spaceScene.instance()

            #debug print

            #set properties of space depending on grid indicies
            space.name = self._namingFunc(i,j)
            space.position = self._positionFunc(i,j)
            var animation = self._animationFunc(i,j)


the positionFunc goes from 45,675 in x+45 steps to the right
and every 8 spaces goes y-45 steps upwards.

(720, 720)


but the field is only one part of the resulting window instead of filling out
the whole window.
also using streching options in settings doesnt change anything.

just noticed while doing the screenshot that the window is definitly
bigger than 720x720 pixels. any idea why that is and how to change it?

what am i doing wrong here?

poked around a bit.
now im not using animatedSprite but just a few spritenodes and changing
visibility of them and after instancing the spaces manually through the
editior i notice that they look way bigger than when using code to instancing.

so my guess is that the spriteTextures get scaled when instanced through code.

no idea though why and how to keep godot from doing this.

in Engine by (18 points)

What is the value of Transform->Scale for your Sprite nodes, or the parent nodes to the Sprites?

both the tiles and the field have a scale of (1,1)

I fixed this for now by handplacing all 64 tiles in the field scene and
renaming/setting color by hand but i still think it would be all cleaner
doing it in code (especially for other games when i want to change how the
field is getting setup)

Please log in or register to answer this question.

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.