0 votes

Hello! Im new to Godot and I’ve been able to solve most problems by drowning in google searches and tutorials, but this problem I really can’t/don’t know how to fix.

So basically I made a top down view game. At first I had a fixed camera view and the player would move around the limits of my camera view. I added enemies to spawn outside of my camera view which worked perfectly.

Now I’ve decided to attach my camera to my player and make the map infinite without boundaries. Ive done that and my player is now in center always moving around the endless map, but the problem now is the enemy spawn location. While my player is able to move endlessly anywhere, the enemies are still spawning in the set location where it used to be.

How do I make it so that the enemies still spawn outside of my camera view while moving around anywhere?

I can’t find any tutorials for it. Any advice?

Thanks in advance!

in Engine by (12 points)

make enemy spawn at:
your old set location + camera position
so spawn location change along with camera position

2 Answers

0 votes

Hello there. I’m also new and someone better than me will write the answers later. I suggest solving this problem as follows. Let's say the enemies have a certain position. The coordinates of the camera or player are added to the coordinates once each time an enemy appears (Enemy.x + = Enamy.x + Player.x). You can also add value to display it outside the camera. I hope you find a solution to the problem if you think about it a bit.

by (45 points)
edited by
0 votes

You Can get the edge of screenspace coordinate and convert to global space coord ,after this done add a little offset in outside direction and set the Vector z tag whatewer you want.
Sorry for my weak english.

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