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

    How to change value during game

    Scheduled Pinned Locked Moved
    Help and Support
    4
    5
    451
    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.
    • F
      Flame Games
      last edited by

      Hi everyone,
      Just asking. In my game I want the speed of the character to change only when it collides with something. I currently use patrol platforms to move the character (because it doesn't need to stop) and I have values connected to their X and Y's. How can I change the value connected to all of them (Because the character consists of 4 parts) to make the character go faster. Basically the current value is 7 m/s and I want to change it to 20m/s during game then change back to 7m/s afterwards. Does this make sense?

      If I could get a response as soon as possible that would be nice because this is currently delaying the game build.

      Cheers,
      Ash

      1 Reply Last reply Reply Quote 0
      • GameCRAZYG
        GameCRAZY
        last edited by

        @Evolution

        What you are trying to do makes a lot of sense!

        Every behavior has something called an input field... If you go into the settings for the patrol behavior, you can click right next to the speed option in order to change that input field.


        Experiment with the behaviors...

        Maybe:
        -Collided with __
        -If (input (drag from behavior)) = (smaller value)
        -Change input field (by tapping next to the setting, and put on the restart behavior option) = (larger value)

        -Stopped colliding
        -Change input field (by tapping next to the setting, and put on the restart behavior option) = (smaller value)

        Or:
        You can get the smallest and largest x and y values, and define parameters. Using if-behaviors, you can figure out whether they are colliding, and then you can have the same follow-up behaviors.

        Or:
        Depending on the other behaviors and how many speeds you will eventually have, you may want to turn on and off "change input field" behaviors. The idea is the same, but you're activating and deactivating the functions in this case.


        I am not good with screenshots... I can make an example though... as long as @Aidan-Oxley and @Jack8680 do not beat me to it XD...

        1 Reply Last reply Reply Quote 0
        • HakanH
          Hakan
          last edited by

          Use behaviour on and off behaviours.lets think an object patrols 5 speed when object collided another object behaviour off patrol 5 and behaviour on patrol 10 and if you want to patrol 5 again you can use wait(or collided) after 7 seconds again behaviour on patrol 5 bahvşour off patrol 10

          GameCRAZYG Jack8680J 2 Replies Last reply Reply Quote 0
          • GameCRAZYG
            GameCRAZY @Hakan
            last edited by

            @Hakan Naw...

            1 Reply Last reply Reply Quote 0
            • Jack8680J
              Jack8680 @Hakan
              last edited by Jack8680

              Set input fields are probably slightly better than behaviour on/off, but both would work depending on what exactly you are trying to do. I don't get exactly why you're using patrol to move the character, but if you want to change them alł easily, you could use a single broadcast message, and use receive message in each part. In the broadcast message select a box container that you set to the speed, then use the output from receive message as the speed of the patrol.

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