Stuck - target with mouse - similar to Codemonkeys pool demo

JamesZeppelinJamesZeppelin Member Posts: 1,927
edited November -1 in Working with GS (Mac)
So i have a game that uses the slingshot style firing system
basically you pull back to aim release to fire

Its a fast pased shooter so i need two guns...

i doubled up on all 8 attributes required for a proper sling aim system however i hit a wall with mouse position??

I'm using the magnitude between the firing point and where my finger is to aim.
I was thinking some sort of work around with game.touch but since you would be pulling and firing left and right i dont know how to have the device know which touch is which

the closest example would be Code Monkey's pool game
being able to fire off two cue balls at once...
its a little different but the aiming principle is the same

Comments

  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    I imagine the slingshots do not occupy the exact same position.

    if that is correct you could qualify which touch should control the sling based on where it s located, then execute the rules specific to the correct touch.

    assuming gameplay is landscape and the guns are on either side of the center of the scene, you could do something like the following in each gun.

    Rules in leftmost gun:
    `
    Rule: if game.touch1.Position.X <= 240
    ---Aim using touch1-based logic
    Otherwise
    ---Rule: if game.touch2.Position.X <= 240
    -----Aim using touch2-based logic
    `
    Rules in rightmost gun:
    `
    Rule: if game.touch1.Position.X > 240
    ---Aim using touch1-based logic
    Otherwise
    ---Rule: if game.touch2.Position.X > 240
    -----Aim using touch2-based logic
    `
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    It will take a bit to get my head around since all the game.touch rules are burried so deep in formulas. but, that def gives me something to work with!!

    So that basically will define what touch1 is vs touch2?

    thanks
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    Thanks totally works!

    Just needed to define touch 1 and touch 2
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    glad to help!
Sign In or Register to comment.