Using layout for levels

For questions about using Classic.

Post » Sat Mar 07, 2009 10:16 am

How would I go about creating a second level with a second layout without using global objects? I was under the impression that instead of recreating the sprite for every layout, I can just set it to global. When I did that, the objects on one layout didn't delete when going to the next.

Can I just copy and paste an object from one layout to another without setting it as a global object? Would it still be the same object or will it be separate where if I wanted to make a, for example, behavior change, I'd have to change it on every layout the object is on?

Any help appreciated!
B
2
S
2
G
3
Posts: 143
Reputation: 1,536

Post » Sat Mar 07, 2009 10:55 am

Yes, that's the better method for visible objects (like players), just copy/paste them over. It won't create a new Sprite, just a new instance.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat Mar 07, 2009 11:16 am

[quote="Rich":2qj4ojfe]Yes, that's the better method for visible objects (like players), just copy/paste them over. It won't create a new Sprite, just a new instance.[/quote:2qj4ojfe]
Oh okay. Though I just did that and some things seem to be acting strangely. The player sprite is moving thrice as fast but I'm still using the same event sheets...

Well, thanks for the help!
B
2
S
2
G
3
Posts: 143
Reputation: 1,536

Post » Sat Mar 07, 2009 11:18 am

That's very strange; all I can think is the behavior properties or something didn't transfer properly.. check them over incase that happened :).
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat Mar 07, 2009 11:44 am

[quote="Shady":33i5459p][quote="Rich":33i5459p]Yes, that's the better method for visible objects (like players), just copy/paste them over. It won't create a new Sprite, just a new instance.[/quote:33i5459p]
Oh okay. Though I just did that and some things seem to be acting strangely. The player sprite is moving thrice as fast but I'm still using the same event sheets...

Well, thanks for the help![/quote:33i5459p]

I had that before. Pretty sure your player sprite isn't on the right layer then.
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Sat Mar 07, 2009 12:03 pm

[quote="thomasmahler":cignj30z]I had that before. Pretty sure your player sprite isn't on the right layer then.[/quote:cignj30z]
The player sprite is on the first layer of each layout.

I just did a test and it seems that on the second layout the player moves twice as fast and on the third it moves thrice as fast. Maybe the MouseKeyboard object is adding up on each additional layout instead of acting as an instance? Maybe it being a custom moving and jumping system has something to do with it too?
B
2
S
2
G
3
Posts: 143
Reputation: 1,536

Post » Sat Mar 07, 2009 3:34 pm

All non-global objects are destroyed at the end of a layout, so it works exactly the same in the events as using global objects, except nothing from the previous layout is left over. If you do have global objects like Mouse & keyboard though, make sure those don't get copied, otherwise you end up with 2 global instances.

This sounds most likely to be a problem in your own events, unless you can reproduce it in a fresh .cap.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Sun Mar 08, 2009 1:47 am

[quote="Ashley":1hzpbacx]This sounds most likely to be a problem in your own events, unless you can reproduce it in a fresh .cap.[/quote:1hzpbacx]
*facepalm*

Okay, I just found out the problem. In the additional layouts I was including four event sheets, but one of them already had three of those event sheets included, meaning it was running them twice... such a stupid mistake on my part!

Thanks for all the help.
B
2
S
2
G
3
Posts: 143
Reputation: 1,536


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests