Scene.index is awesome

jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

I'm spending a few hours updating A Long Way Home. Sales have pretty much stagnated over the past year, so while I'm going through my other apps and updating keywords/icon I'm also taking some of my old games and throwing some interstitial ads and uploading them to google pay and iOS for free.

It's amazing what you learn over the years. I was able to reduce 21 instanced actors into two prototypes, and thanks to scene.index, 100 individual scene change rules into 1.

I wish i had this years ago :) Would have made developing this game much easier.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited March 2014

    @jonmulcahy said:
    I'm spending a few hours updating A Long Way Home. Sales have pretty much stagnated over the past year, so while I'm going through my other apps and updating keywords/icon I'm also taking some of my old games and throwing some interstitial ads and uploading them to google pay and iOS for free.

    It's amazing what you learn over the years. I was able to reduce 21 instanced actors into two prototypes, and thanks to scene.index, 100 individual scene change rules into 1.

    I wish i had this years ago :) Would have made developing this game much easier.

    Yeah, this is a great new feature! I was messing around with it yesterday. It's interesting that, say, you want to change to scene 1 (which you think may be a level, because it's names "1"), but the game actually changes to the first scene in the project. The first scene may be a level select scene or something. I thought that was kinda interesting, but I found a really easy way to get around that. You can actually change scene to a named scene without too much difficulty.

    Needless to say - it saves tons of time.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited March 2014

    @Braydon_SFX said:
    Needless to say - it saves tons of time.

    i knew i stopped watching the intro video too soon! I have like 4 extra rules calculating the index offset, but if i can just do it by name??
    gotta investigate this!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @jonmulcahy‌ - I was planning on a doing a video tutorial on it today. ;)

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Braydon_SFX said:
    jonmulcahy‌ - I was planning on a doing a video tutorial on it today. ;)

    please do, i spent 30 seconds and it didn't work :)
    what i have works, and works well, but that would be so much more efficient.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Great. I'm getting ready to do that now. There are two "easy" methods I've found that work great. One method only requires one change attribute, and the other requires two change attributes. Either way, it's not hard to set up and saves tons of time when setting up a level select, for instance.

  • SmokeyAce73SmokeyAce73 EarthMember Posts: 370

    @‌Braydon_SFX I would really appreciate this

    Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited March 2014

    @SmokeyAce - It's uploading now

    EDIT: Posting now...

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803

    So, since the scenes do not allow for unique names, what you could do is you have a table with a text column and an integer column. The text column is the Unique Name for a scene, and the integer is the scene index. So if you want to "go to a scene by name" you can use the tableSearch on the first column given the name to return the row number. Then you use the returned row number to get the tableCellValue in the integer column for the scene index.

    You could even take that even further and have a group of scene indexes and randomly choose from those to select your next scene.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @CodeMonkey said:
    So, since the scenes do not allow for unique names, what you could do is you have a table with a text column and an integer column. The text column is the Unique Name for a scene, and the integer is the scene index. So if you want to "go to a scene by name" you can use the tableSearch on the first column given the name to return the row number. Then you use the returned row number to get the tableCellValue in the integer column for the scene index.

    You could even take that even further and have a group of scene indexes and randomly choose from those to select your next scene.

    Yep! That's exactly what I'm doing.

  • stueynetstueynet TorontoMember Posts: 166

    @Braydon_SFX said:
    Needless to say - it saves tons of time.

    So can you elaborate on this? My issue is that in order for every scene to know what level it is I have to have to set the level number within the controller in each scene. This is all fine except that if I want to reorder the scenes, I need to change every scene after the re-ordered one.

    For my level select buttons I use Change Scene -> At Index -> self.whatLevel +2 because the first 2 scenes in my game are the splash and the menu screen. However within the levels themselves, is there a way to access the scene index? Or do I have to use an unlocked actor to access the Scene.name value?

    My Latest GS Game - Tiny Spirit
    My First GS Game - Dashing Ralph

  • stueynetstueynet TorontoMember Posts: 166

    @stueynet said:

    Ok with @DeepBlueApps‌ help I got it. Instead of setting the currentLevel from within the scene, you have to set it from the entry point to the scene. In other words before the button takes you to the correct scene, change the game.whatLevel attribute right there.

    Words perfectly.

    My Latest GS Game - Tiny Spirit
    My First GS Game - Dashing Ralph

Sign In or Register to comment.