Change layout and back with same positions?

Get help using Construct 2

Post » Thu Sep 10, 2015 10:40 pm

Hey there!
I decided to make an inventory in a different layout, which the player goes to when opening inventory, but also to return to where the player was when closing inventory.

The problem is; all enemies respawn when i change back to the current layout after closing the 'inventory' -
I know that you have to set position for the character to return to where he/she was standing,
but how do i save all dead enemies to be dead and all alive enemies to be alive, specially when the
type of enemy spawn is random in the stage?

Thanks in advance hehe :P
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Thu Sep 10, 2015 10:45 pm

why don't you use layer instead of another layout?
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Thu Sep 10, 2015 10:52 pm

MadSpy wrote:why don't you use layer instead of another layout?

Hehe hey! Thanks for your response! - Well i dont want it to sit in the background til' the player opens the inventory, it seems to be heavy on the engine no? 50 item slots, stats, lots of text displaying status, hp and mp etc.

Isn't it better to go to a different layout?
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sun Sep 13, 2015 4:37 am

Okay so no one knows? Maybe it cant be done then? hehe
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sun Sep 13, 2015 11:43 pm

You could use array in order to save all infos you need when you reload your layout
But I suggest you to use a layer for your inventory
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Sep 14, 2015 2:16 am

MadSpy wrote:You could use array in order to save all infos you need when you reload your layout
But I suggest you to use a layer for your inventory


Hehe hey thanks for your response!
Wouldn't that though slow down the game if i kept a layer in the background with pictures, numbers and over 50 items? While it stays in the background during gameplay? Thanks in advance hehe :P
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Mon Sep 14, 2015 2:51 am

@Greaver - make the enemy objects Global - so they are not destroyed when you leave the layout. If you randomly create them at the beginning of that layout you will need to set a global variable so that you know not to create them again when you go back to the layout.

Having the inventory on the same layout shouldn't slow things down it you do it right. If you need lot of code to handle the inventory, you can put that in a group and disable it (the group) when the inventory isn't showing. Then there is no unnecessary code running to slow things down...
B
94
S
33
G
20
Posts: 438
Reputation: 17,615


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 9 guests