Creating or not creating items at layer start

For questions about using Classic.

Post » Mon Apr 26, 2010 7:48 am

So... right now we've got a player that can swap between layers as much as they feel like it. But we want it so that only the enemies respawn when the player goes back to a previously visited layer. Items that they've picked up (keys, money) don't respawn. But if they haven't picked up that item before... the item should be there.

I know I could do this by making a long list of all the items and put a 'check' if the player has grabbed it in the past and then destroy it on startup if the player has gotten it. But this seems like it would be rather resource intensive, not to mention being a royal pain to implement.

Is there an easy way to accomplish this? Or a better method? I'm all for using other people's experiences and knowledge!
Posts: 10
Reputation: 670

Post » Mon Apr 26, 2010 11:32 am

Im afraid a list is your best option, but you have several options for that.
What you need is a global. Global means it's carried across all layouts. So when you change a global variable, that value is carried to the next layout. same goes for arrays, incs, etc... that is if you tick global in preferences.
Image Image
Posts: 7,232
Reputation: 60,992

Post » Tue Apr 27, 2010 4:27 am

Everything that Newt said.

I did a really simple example of what you are talking about in the Adventure tutorial part 4 using global arrays. viewtopic.php?f=8&t=4421

Look at that example and perhaps you will get some ideas for an approach that might work for you.
Posts: 835
Reputation: 5,313

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests