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

    Need Help with some coin logic

    Scheduled Pinned Locked Moved
    Help and Support
    2
    15
    364
    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.
    • RobinsonXR
      RobinsonX
      last edited by

      Ah. The only way you can do this is by using Save to File and Load from File. 🤷‍♂️ @SplitMindGaming

      You want to save what coins you have collected and when reentering back into the scene, you want to load the file with the destroyed coins.

      Of course, you will need a way to identify each coin. Assuming that all the coins will be in the same locations every time, you can reference a coin using its position. When a player collects a coin, note its position. You can add this position to an array (can be formatted like this: x,y) representing all the coins you have collected and save the array.

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

        @SplitMindGaming So when reentering back into the scene, load the array with the destroyed coin positions and find all the coin objects with the matching positions to destroy. 😄

        There are many ways you can get the coin object, but I'll suggest the easiest way:

        • Loop through all coins and add a tag to it.
        • This tag will be the initial position of the coin. Can be represented as so: x,y
        • Load the file with the destroyed coin positions - it should be an array.
        • Loop through the array and for each value, use Get Object by Tag to get the coin object with the corresponding position to destroy.
        SplitMindGamingS 3 Replies Last reply Reply Quote 0
        • SplitMindGamingS
          SplitMindGaming @RobinsonX
          last edited by

          @RobinsonX thank you so much for this. I will try it out.

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

            @RobinsonX Hi so I was trying to attempt this But tbh I am in no way shape or form a developer. Im not even sure what behavior systems I am suppose to be utilizing. Is it possible to screenshot the behavior systems needed to make this work or even create a mini project of this working. Thanks

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

              @RobinsonX I would imagine if a mini project were to be made. A character collecting some coins but intentionally missing some. There could also be a button that reloads the scene and it will pick off where it left off minus the collected coins.

              RobinsonXR 2 Replies Last reply Reply Quote 0
              • RobinsonXR
                RobinsonX @SplitMindGaming
                last edited by

                @SplitMindGaming I can make a sample project. Hang on!

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

                  @SplitMindGaming Here's the project: https://bit.ly/3joSEVK

                  Open it in safari if it does not work here. :)

                  • You can collect coins and restarting the scene will leave those coins destroyed
                  • You can intentionally leave coins behind and those coins will still remain after reloading the scene
                  • There is a way to reset the destroyed coins save to revert all the coins to normal
                  SplitMindGamingS 2 Replies Last reply Reply Quote 0
                  • SplitMindGamingS
                    SplitMindGaming @RobinsonX
                    last edited by

                    @RobinsonX wow thank you so much for this. Im putting you on the ending credits :)

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

                      @RobinsonX also what would you suggest I study or learn to better understand how to use behaviors like that. Because looking at the file I would have never guessed to use any of those behaviors.

                      RobinsonXR 1 Reply Last reply Reply Quote 1
                      • RobinsonXR
                        RobinsonX
                        last edited by RobinsonX

                        @SplitMindGaming Sorry for late response - I actually learned through trial and error!

                        I trained myself to study a behavior I want to learn and observe its properties. I know I sound like a nerd, but hyperPad encourages you to be a scientist and over time, you start to learn many processes that you wouldn't expect to grasp on. It ushers you into thinking critically and puts you in a perspective of a programmer.

                        I look at a behavior and its reference, form a hypothesis and then test. After a while, I will know exactly what a behavior does and can use it to my advantage.

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

                          @SplitMindGaming I know some people want guidance on how to learn hyperPad, so I would suggest looking at examples and documentation (yes, video tutorials help too!). But you will need to learn exactly how the behavior system works.

                          I'll summarize the behavior system:

                          • Behaviors are executed from left to right (there are 2 exceptions)
                          • There are 2 types of behaviors: Event and Action
                          • Event behaviors tell the behaviors when to execute
                          • Action behaviors tell the behaviors what to execute and what to do
                          • If an Action behavior is not connected from the top, it will execute immediately when the scene runs
                          SplitMindGamingS 1 Reply Last reply Reply Quote 0
                          • SplitMindGamingS
                            SplitMindGaming @RobinsonX
                            last edited by

                            @RobinsonX Thanks for this. Honestly if it wasnt for your videos also I would be lost in alot of things. You do a good job of explaining things clearly yet also adding humor to your videos. Great work

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