Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / help with group Arrays within the Studio Scene editor

Years of Service
User Offline
Joined: 1st Mar 2019
Posted: 3rd Dec 2020 10:16
Hi all,
for my platform game I have collectables for each level which I have placed using the built in scene creator and then assigned to a group Array called eggz

Then when I want to check if you have picked any of them up I do this :

But because Studio appends a scene specific tag (the 'lvll1' bit) , it means I have an array for each level and I have to have the above piece of code for each level too which seems inefficient. Ideally I want to be able to use the same bit of code for every level because you'll be doing this same thing on each level. It would be great if I could just change the 'lvl1' part to say 'lvl2'

Is there a neater way to do it? is it just so obvious I can't see it?

thanks for any help in advance
AGK Developer
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 3rd Dec 2020 10:58
"But because Studio appends a scene specific tag (the 'lvll1' bit)..."

Remove the scene-specific part of the array name?

It sounds like you are using the Visual Editor. If so, change the variable, array, etc names to whatever you need them to be.
Years of Service
User Offline
Joined: 1st Mar 2019
Posted: 3rd Dec 2020 11:40 Edited at: 3rd Dec 2020 12:57
maybe it's not immediately clear, but I call each level that i make in the scene editor "lvl X" it could be called anything i guess. it appends the scene name to the start of the array name so my group array 'eggz' gets called 'lvl1_eggz'

I'm using the built in scene editor in studio. and this :

turns into this

if I just remove the lvl1 bit in my code I get 'Error: "eggz" has not been defined as an array'

currently my workaround is to have a separate scene counter and then say

and this works out, but only because there are only 8 levels, Imagine I had 99 levels, what would i do then?
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Dec 2020 20:26 Edited at: 3rd Dec 2020 20:52
I don't use the scene editor but from what you have said I don't think you can get away without referencing each scene individually.
Maybe storing the entire scene in a temporary array would be the go
Something like this (From your example)

thinking about it a bit more maybe you should do this;

On a larger scale it might look like this
Years of Service
User Offline
Joined: 1st Mar 2019
Posted: 4th Dec 2020 10:12
Thanks for the detailed response blinkOK, I really wasn't expecting a thorough breakdown like that, much appreciated!

for this bit though

I'll still need one of these for each level?

Unless I'm misunderstanding your code and despite it being more elegant, I think it has the same issue as mine in that we need to get the fixed level information for each level (lvlX_eggz) into a dynamic format that can be used for all the levels.

Ultimately I guess I was hoping for a a$="lvl_" + str(x) + "eggz" sort of a solution

again though, thanks for putting your time into looking for an answer.
Years of Service
User Offline
Joined: 12th Nov 2016
Posted: 5th Dec 2020 15:44 Edited at: 8th Dec 2020 12:27
I usually would do something like BlinkOk said.. where id set like

Only other way I see is maybe #include a blank text file at the beginning.. and then maybe .. hmmm..

Create a function that will rewrite the function on the blank text file and then call it after.
Like if you wanted to get a sprite from a world or level...

Maybe use it like
spr = GetSpr(1,1,"eggs")


Login to post a reply

Server time is: 2021-09-25 16:30:06
Your offset time is: 2021-09-25 16:30:06