hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Restart Scene Glitch

    Scheduled Pinned Locked Moved
    Help and Support
    2
    15
    424
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KamdroidK
      Kamdroid
      last edited by

      I recommend refresh to be on.

      What things are you trying to restore when the scene is restarted?

      SplitMindGamingS 1 Reply Last reply Reply Quote 0
      • SplitMindGamingS
        SplitMindGaming @Kamdroid
        last edited by

        @Kamdroid doesnt refresh start the scene as it is brand new? Lets say i have already collected 20 coins. If i click refresh the scene would just load back at 0. Unless I am doing something wrong with save and load function

        SplitMindGamingS 1 Reply Last reply Reply Quote 0
        • SplitMindGamingS
          SplitMindGaming @SplitMindGaming
          last edited by

          @SplitMindGaming yup just tested it out again with a simple interface. I have it save some coins. It was suppose to load it right on startup but with refresh on it doesnt do that.

          KamdroidK 1 Reply Last reply Reply Quote 0
          • KamdroidK
            Kamdroid @SplitMindGaming
            last edited by

            @SplitMindGaming Just made a test project and it works fine, your behaviours must be wrong.

            SplitMindGamingS 1 Reply Last reply Reply Quote 0
            • SplitMindGamingS
              SplitMindGaming @Kamdroid
              last edited by

              @Kamdroid would u mind sharing that test file. I want to see where i went wrong. Because i cannot load and save from a refresh scene for some reason.

              KamdroidK 1 Reply Last reply Reply Quote 0
              • KamdroidK
                Kamdroid @SplitMindGaming
                last edited by

                @SplitMindGaming Here, open in Safari:
                CoinSave.tap

                SplitMindGamingS 1 Reply Last reply Reply Quote 0
                • SplitMindGamingS
                  SplitMindGaming @Kamdroid
                  last edited by

                  @Kamdroid ohh i see what i did wrong now. Thank you for that.

                  1 Reply Last reply Reply Quote 0
                  • KamdroidK
                    Kamdroid
                    last edited by

                    All logic is in the player.

                    Also supports having custom coin worth values for each individual coin.

                    SplitMindGamingS 2 Replies Last reply Reply Quote 0
                    • SplitMindGamingS
                      SplitMindGaming @Kamdroid
                      last edited by

                      @Kamdroid yes i seen you used dynamic. Its very smart.

                      1 Reply Last reply Reply Quote 0
                      • SplitMindGamingS
                        SplitMindGaming @Kamdroid
                        last edited by

                        @Kamdroid hey with the file you provided. How would you set it up so once it collects and adds 1 of the coins to the score. The next time it loads it will ignore that one certain coin and not add it to the score?

                        KamdroidK 1 Reply Last reply Reply Quote 0
                        • KamdroidK
                          Kamdroid @SplitMindGaming
                          last edited by Kamdroid

                          @SplitMindGaming Ignores the coins how?

                          Do you want any coins already collected to not show up on scene restart?

                          Or to still be visible, but not effect the score when collided with?

                          1 Reply Last reply Reply Quote 0
                          • KamdroidK
                            Kamdroid
                            last edited by Kamdroid

                            Personally, since we have object referencing (object IDs)

                            I'd store every coin ID the player collided with, in an array.

                            When colliding with a coin, I'd check if that coins ID is already saved in the coin collided array,

                            However, I remembered hyperPad doesn't even have an if array coins option (as far as I know). Previously I've used a loop to check all elements, but this has pretty bad performance. Ask @Hamed or @Murtaza

                            So I would just loop the array at the start, delete or set some attribute to "collected" of the coin object.

                            Or you could even try using a dictionary which lets you enter a key (the object ID), pretty sure it returns null key doesn't exist, so that can be like a workaround if contains.

                            SplitMindGamingS 1 Reply Last reply Reply Quote 0
                            • SplitMindGamingS
                              SplitMindGaming @Kamdroid
                              last edited by

                              @Kamdroid Thanks for that. Do you know if you can save to file a collision? So the next time the game starts it will load that collision then you can simply give it an ignore collision with that certain object? Or maybe even something similar.

                              1 Reply Last reply Reply Quote 0
                              • KamdroidK
                                Kamdroid
                                last edited by

                                The collided behaviour gives 2 outputs. Object A ID and object B ID

                                Object B would be the coin you collided with

                                Use modify array behaviour to append object B ID to an array (get coinsArray attribute).

                                Save that array to file and change coinsArray attribute to the array as well (set coinsArray attribute)


                                At the start, load collide array from save file and loop the array.

                                Use get array item with index "loop index"
                                That will be the coin ID. Set an attribute to tell it's already been collected, change the color, etc.

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post