• 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 instance being created in 2 places

TRP

Member
Hi there,

I'm running into an issue. I'm creating an instance when the player obj is in contact with an an island obj

in step:

if
(distance_to_object(obj_island1) < 10)
instance_create_layer(350,75,"particles",obj_Gov_Two)
}

the issue is that it's being created in 2 places. 1 @ 350,75 in the room and 2 @ 350,75 on the view(which follows the player in a large room) I want 2. How do I stop it from being created at the room coordinates too?


the pic below shows the one with the text you can see following the 350,75 view or camera coordinates. The one with the text you can't see(the text is actually under the background. why i have no idea) is at 350,75 room coordinates.

I'm curious why this is happening? I hope I'm explaining it correctly. Any help is appreciated.


Thanks!

gmforum.jpg
 
Last edited:

Nidoking

Member
Are you sure there are only two? There might be 60 per second, and if you're changing something along the way, they're just drawing in two different places based on the settings when they were created. The question is what logic this is wrapped in that leads to it happening more than once, or more precisely, what logic you're missing that would prevent it from being created more than once.
 

Xer0botXer0

Senpai
GML:
if

(distance_to_object(obj_island1) < 10)

instance_create_layer(350,75,"particles",obj_Gov_Two)

}
where do you set distance_to_object >= 10 ?
which therefore would prevent more instances being created.. infact it appears as 2 but it might be hundreds!
 

TRP

Member
Thanks for the replies!

I set the distance in an alarm event of the player. It only makes 2. I know this because the text box uses a set alpha for transparency and if hundreds were being created it would become a solid color over a short period of time. I'm thinking somehow some layer or room inherit property got mixed up.
 
Last edited:

TRP

Member
Solved it!

issue was how i made the actual portrait object.

to fix it I chose none for the obj's image then I took out Draw self from Draw GUI and replaced it draw sprite. Works fine now just like i wanted it too! Thanks for all that replied! Appreciate it.
 
Top