• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED]Object spawning behind View

E

Edoran

Guest
I am running a script where when the player moves next to an npc and they hold 'up' a new view(1) appears above them. This also spawns in a new object into the new view that the player controls.

The new object however is spawning BEHIND the new view(1) and I can't figure out how to bring it in front.

Any help or suggestions appreciated.

Thanks
 
S

SyntaxError

Guest
Sounds like a depth issue. Reduce the depth of the newly spawned object to less than that of the object that creates it.
 
E

Edoran

Guest
I have tried this. I even set the depth for the spawned object to -1000000 and it was still behind. There seems to not be a way to set the depth for the new view?

Thanks
 
S

SyntaxError

Guest
Probably need more info.

Are you creating this new view inside another view?
Is the object created in the correct position in the correct view?
Are you setting the depth inside the draw event? (This won't work.)

Showing code would also help for both objects.
 

TheouAegis

Member
Pretty sure if the object is drawn in view 0 and you're trying to draw view 1 at the same position, view 1 will always be over view 0.

Maybe draw the player and NPC's sprites on the GUI layer.
 
E

Edoran

Guest
I have figured it out!

I was spawning the object in view(0), rather than view(1) where I wanted it, thus always being behind view(1). Just changed the coords to the right place in the room.

I got there because of your questions, so thanks for the help!!
 
Top