#My enemy spawn in the middle of the map outside of the camera

17 messages · Page 1 of 1 (latest)

weary kite
#

@tight monolith what part of your code tells the objects to spawn relative to the camera

tight monolith
#

Well in the method getRandomSpawnPosition it returns spawnPosition and in the method SpawnObject it sets a vector2 to getRandomSpawnPosition

#

and it instantiates a gameObject at spawnPosition

weary kite
#

Okay

tight monolith
#

do you know how I can fix it.

weary kite
#

does this make sense?

tight monolith
#

How would i make it n ot a box around the orgin

#

origin*

tight monolith
#

@weary kite

weary kite
#

You need to offset the position generated by the camera position

tight monolith
#

how would i do that

#

@weary kite

weary kite
#

Are you familiar with vectors

#

Get the camera position and add it to the spawn position

tight monolith
#

alr

#

Alright I got it to work with this code. Thank you so much for the help