0 votes

Dear community,
while working on a project for school, a problem turned out that really messed everything up. The project I'm working on is level-based. Every level (root is Node2D) has got an instance of the player scene, containing a Camera2D as a child so that the cam moves along the player. Also, there is a Control-Node which is supposed to draw the GUI. Here is the very simple script for the Control-Node:

extends Control

func _process(delta):

func _draw():

Basically, it draws the circle fine, until the Camera2D-Node moves. Then the circle instantly disappers. When the Camera comes back to it's former position, the circle comes back again. The cam just temporarly disables the _draw function of the Control Node when it doesn't like it's position. How is that possible?

For more Info, the Camera2D-Node:

[node name="Camera2D" type="Camera2D" parent="Player"]
current = true
limit_left = 0
limit_top = 0
limit_bottom = 0
drag_margin_left = 0.0
drag_margin_top = 0.0
drag_margin_right = 0.0
drag_margin_bottom = 0.0
in Engine by (12 points)

1 Answer

0 votes

Use viewport instead of Camera2D. When the camera moves its position is not passed and results in a NULL. This does not occur in Viewport.

by (204 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.