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

    How do I make a character shoot in the direction I drag him

    Scheduled Pinned Locked Moved
    Help and Support
    3
    6
    943
    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.
    • MiniwolfenM
      Miniwolfen
      last edited by Miniwolfen

      So I have a game where what I want is to be able to have a character that's shoots in the direction I drag him. When I drag him at the moment in any direction he shoots from the top, bottom, left and right at the same time. How do I make it so that when I drag him up he shoots up and vice verse

      Aidan_FireA 1 Reply Last reply Reply Quote 0
      • Aidan_FireA
        Aidan_Fire @Miniwolfen
        last edited by Aidan_Fire

        @miniwolfen Does the character move when you drag it, or it stands still but dragging in a direction makes him shoot? Is it using the drag and drop behaviour? I would do it differently depending on what exactly is happening.

        MiniwolfenM 1 Reply Last reply Reply Quote 0
        • MiniwolfenM
          Miniwolfen @Aidan_Fire
          last edited by

          @aidan-oxley it moves and shoots when I drag it

          Aidan_FireA 1 Reply Last reply Reply Quote 0
          • MurtazaM
            Murtaza Admin
            last edited by

            We need more information than that to really help you come up with a solution. There are many different ways of doing this and a lot depends on how your game is currently created and what you want the outcome to be.

            From your first post we get that it shoots when you drag. But answering each of aidians questions will really help get you the best answer.

            Try to be as detailed as possible since we are not seeing your project or in your brain to know what you’re trying to accomplish :).

            1 Reply Last reply Reply Quote 0
            • Aidan_FireA
              Aidan_Fire @Miniwolfen
              last edited by Aidan_Fire

              @miniwolfen Ok, made an example project, involves a bit trigonometry, here's a link: http://bit.ly/2BeWmyb
              Object just shoots every 0.5 seconds, once you start dragging it, it starts shooting in the direction it is moving. The object has to be physics for this one to work.

              I'm not sure whether it will work or not for you since I made it in the beta version, but you might be able to look at the behaviours inside the red square (the label does nothing useful at all). If you can't, tell me and I'll screenshot it for you.

              If you want, I can modify it to also make the bullet shoot faster depending on how fast you are moving. But this also depends on how fast your bullet is, if it's really fast then there's not much point doing it if the player is quite slow in comparison.

              MiniwolfenM 1 Reply Last reply Reply Quote 0
              • MiniwolfenM
                Miniwolfen @Aidan_Fire
                last edited by

                @aidan-oxley thanks

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