go to layout and restart layout

Get help using Construct 2

Post » Wed Nov 06, 2013 8:09 pm

Hello. I need guidance :)

Here is the problem. Whenever I use System-go to layout or System-restart layout my experiment gets terribly slow and instantly unusable.


Gaming - experiment - If actor dies and I just want to restart scene I use system restart layout. Is this the right approach because in my case I cannot use it. If I go from game scene to main menu it is soo slow as if 2 instances were running in the background (for example). God forbid if I return from main menu to game scene...

Its a rookie one:)

byebye
mox

p.s. another example: if I start game scene from C2 it works beautifully, but from main menu - on sprite click go to layout it is terribly laggy and some more intensive AI functions do not even execute ...
B
9
S
3
Posts: 88
Reputation: 931

Post » Thu Nov 07, 2013 9:30 am

Think it would be easier to help you if you could post the code.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Thu Nov 07, 2013 1:03 pm

As above ^^ It's a hard one to visualize without the code.
Are there any variables or arrays that you forgot to reset at the start of the layout?
B
6
S
2
Posts: 23
Reputation: 712

Post » Thu Nov 07, 2013 6:20 pm

If you have an logic keying off of global variable or arrays as stated, these need to be dealt with before the restart. Especially if your on start of layout does anything with them..
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,603

Post » Thu Nov 07, 2013 7:22 pm

Thx people! I know this was a broad question and cannot be commented further upon without code. I was just wondering if it is the correct approach. Thx and will try to find my runaway code :)

byebye
B
9
S
3
Posts: 88
Reputation: 931

Post » Tue Nov 12, 2013 9:30 pm

ok people.

By bugtracking and selectively disabling sections of code found the problem. At start of layout I randomly created lots of objects (instances) , some with further pathfinding logic... When layout restarts I assumed layout code simply restarted ("with cleanup") but that doesnt seem to be the case. I added at the end of event sheet: destroy all objects and voila: FPS nicely at 55 to 60 on every restart (actually I use go to layout).

Thx people!

btw: what is the difference between: layout1: go to layout 1 or layout1: restart layout. ?
B
9
S
3
Posts: 88
Reputation: 931


Return to How do I....?

Who is online

Users browsing this forum: WesleyDeveloper9 and 8 guests