New layout issue / unwanted sprite spawning

Discussion and feedback on Construct 2

Post » Thu Aug 08, 2013 4:47 pm

Hi.

When the new layout loads, i see the blood splat animations spawn. I assume this is because once the new layout is loaded the previous monsters are destroyed and it then spawns the animation on the new layout.

How can i prevent them from spawning on the new layout.

Any advise would be appreciated.

event is
on monster destroy -> spawn "bloodsplat animation sprite"
on bloodsplat animation finished -> destroy "bloodsplat animation sprite"

Then if the player dies
on player health = 0 --> go to "end game layout"


Thanks
B
8
S
2
Posts: 163
Reputation: 1,115

Post » Thu Aug 08, 2013 5:45 pm

Use a global variable to track if the level is over or not and only spawn the blood if level is not finished.
B
55
S
28
G
18
Posts: 1,520
Reputation: 25,305

Post » Fri Aug 09, 2013 4:55 am

You can also possibly make a "On start of layout" event and put a "bloodsplat destroy" action in it.

It's unlikely that the bloodsplats are rests from the previous layout, since when you go from a layout to another, instances are automatically destroyed (unless you've set your object type to be global, in which case the instance would "survive" from a layout to another. In that case, simply put the "Global" property to "No").Kyatric2013-08-09 04:55:55
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
267
S
95
G
66
Posts: 7,210
Reputation: 73,086

Post » Sun Aug 11, 2013 12:53 pm

Thx guys. I tried the global variable, couldn't pull it off. So i went with the event sheet for layout 2 and did the on start of layout destroy blood.

That seemed to have done the trick.

Thank you. :)
B
8
S
2
Posts: 163
Reputation: 1,115

Post » Sun Aug 11, 2013 2:21 pm

I had this problem. What you have to do is make a family for each of your text, particles and sprites and destroy them at the end of the layout. This might be a good one line option to put in when we are changing layouts as it can cause a lot of problems.
B
70
S
11
G
6
Posts: 348
Reputation: 8,399

Post » Sun Aug 11, 2013 2:59 pm

Ya I had to destroy almost every object manually in my game (none of them are global) so it's probably a bug that some objects transfer somehow (although I haven't checked if its been fixed in recent months).
B
141
S
68
G
17
Posts: 1,769
Reputation: 20,224

Post » Sun Aug 11, 2013 6:29 pm

I will try the family thing. Will be easier. Noticed it must be a bug. Objects are not global but do get transferred.

So no it hasn't been fixed.

Im pretty excited. Trying for buying. Hoping the dev's would keep improving the Tool. Its a really awesome app compared to others ive tried. Especially for people who cant code like me.

Making good progress on my game :)
B
8
S
2
Posts: 163
Reputation: 1,115

Post » Sat Aug 31, 2013 7:14 pm

I have some globals that were showing up in unwanted places on other layouts. I noticed they were all on the 0 layer, so I created a new bottom layer called "Limbo" and made it invisible. Now when I switch layouts I don't have to worry about the globals showing up in places they shouldn't, and I can grab the ones from "Limbo" as needed. It's a pretty simple fix.
B
10
S
4
G
1
Posts: 58
Reputation: 1,420


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests