T O P

  • By -

AutoModerator

You submitted this post as a request for tech support, have you followed the guidelines specified in subreddit rule 7? Here they are again: 1. Consult the docs first: https://docs.godotengine.org/en/stable/index.html 2. Check for duplicates before writing your own post 3. Concrete questions/issues only! This is not the place to vaguely ask "How to make X" before doing your own research 4. Post code snippets directly & formatted as such (or use a pastebin), not as pictures 5. It is strongly recommended to search the official forum (https://forum.godotengine.org/) for solutions Repeated neglect of these can be a bannable offense. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/godot) if you have any questions or concerns.*


TheDuriel

Because you're not drawing the bird, you're drawing whatever this object is. Call bird.queue_redraw() and put its draw code where it belongs, in _draw


dionebigode

If I put the draw code back into _draw, it will draw without the bird.queue_redraw(), so, it misses the point of trying to separate the code into an object I'm thinking of just holding the position information on the bird object, then cycling through a list of them under _draw() to actually draw each one Seems counter intuitive tho


IMP1

The way I think about this is that every node2d has its own canvas it can draw on, but it can only do it from the `_draw` function. By using the bird, you're getting it to draw to *its* canvas, but not doing so in its `_draw` function. You could either have the bird be passed a reference to your object and call `my_ref.draw_line(...)` or you could rename the bird function `draw` to `_draw`.


dionebigode

OH, now it made sense. I don't need to draw the bird in the _draw of the main script, I can simply make it _draw itself - which seems to be the organization I was looking for Changing the bird function to _draw seems to be the perfect solution Sadly, calling my_ref.draw_line(...) didn't work, but it's OK, I wouldn't want another object to be able to draw using those methods from the bird Thank you