Multiple Layouts

Forum Home Forum Home > Construct Classic > Construct Classic Discussion > Help & Support using Construct Classic
 Post Reply Post Reply
Author
311 Rep
Post Options Post Options   Quote fiddilydee Quote  Post ReplyReply Direct Link To This Post Topic: Multiple Layouts
    Posted: 14 Jul 2012 at 9:20pm
I have a very basic inventory that basically just looks to see whether an object is overlapping an inventory, on it's own layer. Is there a way to have my inventory carry over to the next layout?
Back to Top
5,270 Rep
Post Options Post Options   Quote tulamide Quote  Post ReplyReply Direct Link To This Post Posted: 15 Jul 2012 at 1:05am
Yes, there is. It is the property "Inheritance layer"
Name the layer that shows your inventory and in another layout just create a layer and enter that name in the text field of the property.

Layout 1
Layer named "MyInventory"

Layout 2
Layer named "Whatever"
Inheritance Layer Property of Layer "Whatever" set to "MyInventory"

There are issues with positioning, so this works best if both layouts have the same dimension, or if the layer you want to inherit is set to not zoom or scroll (both 0%)
Back to Top
311 Rep
Post Options Post Options   Quote fiddilydee Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 2012 at 10:57pm
Sorry it took me a while to try this out because I thought I had decided on a different way of doing things. Now I want to have multiple layouts again but I cannot get this to work. The objects will not carry over to the next layout. The layer pops up in its original form but not with any of the sprites that have been added to the layer.
Back to Top
5,270 Rep
Post Options Post Options   Quote tulamide Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 2012 at 11:45pm
Originally posted by fiddilydee fiddilydee wrote:

The layer pops up in its original form but not with any of the sprites that have been added to the layer.
Then you've done something wrong. Here is a basic example: inheritance.cap
Back to Top
311 Rep
Post Options Post Options   Quote fiddilydee Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 2012 at 1:37am
No that works fine but it doesnt help if you add another sprite to the layer. If it spawns a sprite for example or you drag and drop it on there, it won't stay when you switch to the next layout. I can get it to do what you did, in the second layout it's as if the layer rebooted.
Back to Top
5,270 Rep
Post Options Post Options   Quote tulamide Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 2012 at 4:12am
Just make the objects of the inventory layer, that you create at runtime, 'global' (under properties->common)

Objects (and instances) that are local and are created during runtime will get destroyed as soon as you switch to another layout. To keep them alive, they need to be global in scope.

Here's the extended example cap: inheritance2.cap

Edited by tulamide - 27 Jul 2012 at 4:13am
Back to Top
311 Rep
Post Options Post Options   Quote fiddilydee Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 2012 at 1:24pm
I gotta say Mr. Tulamide you have been a real help to me getting this project going. I think you have solved or at least explained every problem I have had so far. I really appreciate it, If I ever finish this game I will give you a credit as programming consultant, lol. Unless it ends up horrible and you don't want your name on it, which may be the case, but again thank you very much. Oh and yeah that worked.
Back to Top
5,270 Rep
Post Options Post Options   Quote tulamide Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 2012 at 8:36pm
Thank you
I'm glad I could be of help. And imagine my big grin. "Progamming consultant"? Sounds good!

I hope you'll finish it. Can't wait to see that credit entry...
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down