Touch conrols

DOappsDOapps Member Posts: 10
edited November -1 in Working with GS (Mac)
in my game i have a guy holding a gun

the gun is a seperate actor in my game

i want to be able to touch somewhere on the screen and have the gun point towards where i'm touching.
i also want to be able to move my finger on the screen and have the gun follow where im pointing but remain on a fixed axis

kind of like the cannon in the cannon shooter example on game salad but substitute touch instead of mouse movement.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    youll want to constarain the guns rotation to vectorToAngle(mouse.position.x-self.position.x',mouse.position.y-self.position.y')
  • DOappsDOapps Member Posts: 10
    are you sure i want to put mouse position instead of touch position

    what you said isnt working.any other suggestions?
  • m456arcusm456arcus Member Posts: 189
    I think he meant touch position.
  • DOappsDOapps Member Posts: 10
    he said (mouse.position.x)
  • m456arcusm456arcus Member Posts: 189
    Right, but instead try touch position X and Y. Still, mouse position should still work, I think. Whats not working?
  • DOappsDOapps Member Posts: 10
    i put in the lines of code he told me to but nothing happens. do i have to implement it with a rule or something else?

    can you try to make what i wanted and tell me how you did it?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    mouse and touch are the same thing on the device
  • DOappsDOapps Member Posts: 10
    nevermind i got it to work

    thanks
  • DOappsDOapps Member Posts: 10
    wait, one problem

    i want the gun to follow my finger only on the one side.

    right now it follows wichever side is facing closest to it
Sign In or Register to comment.