There’s a ghost in my simple shooter game

it’s so weird, i tried fixing myself but i just can’t find why it was happening

5 Likes

Question is: what do you mean by “ghost”?

3 Likes

there were one object that was flickering at the start of the game

3 Likes

and after some time, my shooter stopped shooting

4 Likes

Oh, that’s normal. It’s because when the object is cloned it starts out at 0% invisibility. You can use a blank text object to prevent this (just make sure you set the image to the one you want via code).

Also, don’t forget the max clone limit is 4096. Try using limited clones, or destroy the old ones when they leave the screen.

6 Likes

Nah it’s just haunted lol

5 Likes

um it didn’t work

2 Likes

Well there are other things you’ll have to do for a shape that was cloned from a text object to appear correctly, such as resizing via set width + height, usually right after setting the image. I mainly use text objects and have no issues making different shapes appear.

I would also recommend setting invisibility to 100% once it clones, before setting the image, then set it back to the original invisibility when it’s needed.

2 Likes

i’ll try my best, i hope i can fix it

I see what’s happening. You are setting the size of the dot to 50% before the position.

Right now, I’ll call your “clone index 2 = self clone index” the “start trigger”

When the object is cloned, it’s moving forward by 2 while its size is 0%.
When start trigger is true, the size is set to 50%, and it appears near the spot where it was cloned, then one frame later, it sets position to the edge of the screen.

Instead, you want start trigger to set the position first, then size, so that it goes to the edge before appearing. This should get rid of the ghost effect you’re seeing.

For me, changing this code is what fixed the problem.

I changed the code above by combining it into one rule.

Now, the rule triggers when your start trigger is true.
First, it sets your variables and position (originally the 2nd rule).
Then, it sets the size to 50 (originally the 1st rule).
Then, once the health is 0 the circle sets size to 0 (originally the “game is playing” rule, but I assumed that check only happens after the circle spawns).

(You don’t need to add set invis for this to work)

4 Likes

tysm, i been scratching my head hard for this.

3 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.