0 votes

I'm very new to Godot and thought I'd start by making Conway's Game of Life.

I'm wondering though where to draw the pixels, unless I can draw directly on to the window I reckon I need something like Node2D or Sprite element, the problem with them though is that their size can only be set using the Scale field, which I'm not sure I can use to make it pixel perfectly fill the window (it would be easier if they had something like Width and Height fields (e.g. w: 1024, h: 600) rather than Scale), and I suspect that scale may just scale a limited set of pixels rather than give me a pixel for every pixel on the window.

So what element can I use, how can I make it fill the window pixel perfectly (have access to 1024x600 pixels for drawing), or do I perhaps not need an element?

I'll figure out the draw commands later (my guess is I just use draw_rect for every pixel)

in Engine by (21 points)

2 Answers

0 votes

You're getting this wrong.

A Sprite isn't a Texture.
A Sprite holds a Texture.

You can get this Texture using Sprite.get_texture(). This Texture has its own functions, which include everything you need. You can also get the size of the window using OS.get_window_size().

Personally, I would go for a TileMap, which will simplify the logic, but do what you must.

by (1,120 points)
0 votes

Node2D don't have a size in any meaningful way. The bounding box in the editor is only really useful to let you see where one is. You can draw outside of it, as far as i know.

But if you need a basic node that has a size you can set, you can use Control.

by (468 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 Frequently asked questions and 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 [email protected] with your username.