I’m working on a game enemies are supposed to spawn all over the map (sometimes off the current screen) and head toward the player. I can’t seem to get them to be created off-screen, they are always in the current screen when I create them. I’ve tried moving the camera, creating them, and moving it back. Any thoughts?
Creating an entity off-screen [Solved]
Ultima2876
(Ultima2876)
#2
Could you post a little code showing how you’re creating them? It should be as simple as setting an X/Y position for them that is outside of the screen bounds.
jacobalbano
(Jacob Albano)
#3
The position of the entity isn’t relative to the camera, so it should be as simple as doing this:
// 100 pixels to the left of the screen edge
e.x = FP.camera.x - 100;
// 100 pixels below the bottom of the screen
e.y = FP.camera.y + FP.height + 100;
Ultima2876
(Ultima2876)
#5
This topic was automatically closed after 2 days. New replies are no longer allowed.