On Start Of Layout doesn't work

Get help using Construct 2

Post » Thu Feb 26, 2015 12:12 pm

On Start Of Layout action doesn't work after returning from another layout with Go To Layout action.

On game layout I have game objects and non game objects (like high scores text and words "game over").
On Start Of Layout event destroys all non game objects, and when game ends I create them again.

After that I'm going to another layout and then back with Go To Layout action. But On Start event is not working this time, I see same objects that I had on the end of game: high scores text and words "game over". Why it's not destroyed? What I'm doing wrong? Before I was using Reset Global Variables, but right now I can't use it, because different variables loading from WebStorage on different layouts.

Upd: Thanks for your help guys. Problem was in code - end game action was activating when shouldnt.
Last edited by deadbus on Fri Feb 27, 2015 9:51 am, edited 1 time in total.
B
3
Posts: 5
Reputation: 185

Post » Thu Feb 26, 2015 12:17 pm

It's easier you hide and show these non-game objects with a separate layer.
Image
B
15
S
7
Posts: 126
Reputation: 1,865

Post » Thu Feb 26, 2015 12:22 pm

You likely have set those objects as global or something.
Consider posting your capx for further examination, that will be easier to establish what's going wrong.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
276
S
103
G
84
Posts: 7,289
Reputation: 83,098

Post » Thu Feb 26, 2015 1:06 pm

Kyatric wrote:You likely have set those objects as global or something.
Consider posting your capx for further examination, that will be easier to establish what's going wrong.

No, it's not global. Maybe I'm wrong and On Start Layout action starts just once - when I first time on this layout, and after that I have to use Restart Layout action?

EstudioCelula3 wrote:It's easier you hide and show these non-game objects with a separate layer.

I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.
B
3
Posts: 5
Reputation: 185

Post » Thu Feb 26, 2015 1:16 pm

deadbus wrote:I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.


Just put these buttons in a separate layer. Turn this layer visible in your game over conditions and invisible in gameplay. Put conditions in your buttons to user click them only when layer is visible.
Image
B
15
S
7
Posts: 126
Reputation: 1,865

Post » Thu Feb 26, 2015 1:23 pm

EstudioCelula3 wrote:
deadbus wrote:I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.


Just put these buttons in a separate layer. Turn this layer visible in your game over conditions and invisible in gameplay. Put conditions in your buttons to user click them only when layer is visible.

Ok I get it, but I looked once again, and I think it won't solve problem. On Start action else have to reset some variables, but it doesn't happens.
B
3
Posts: 5
Reputation: 185

Post » Thu Feb 26, 2015 1:24 pm

Then please post your CAPX or a screenshot.
Image
B
15
S
7
Posts: 126
Reputation: 1,865

Post » Fri Feb 27, 2015 9:50 am

Thanks for your help guys. Problem was in code - end game action was activating when it shouldnt.
B
3
Posts: 5
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: DivineVoider, odiusfly, Snowmany and 1 guest