Ragdoll Blaster

creativeappscreativeapps Member Posts: 1,770
edited November -1 in Working with GS (Mac)
I want to create ragdoll blaster type cannon. Suppose user tap near to cannon then cannon fire with low power and if user click distance is far from cannon that time cannon fire with more power.
Is there any example demo available for that? Please let me know how to do that? Thanks

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    the cannon demo in the main page of your new section of gameSalad.
  • creativeappscreativeapps Member Posts: 1,770
    yes I know but its showing power left side and I want to use power depends on where user tap.

    For example distance between cannon and player tap is 50 pixel that time cannon blast slowly and when distance is 400 that time cannon fire with more power.
  • hotMagichotMagic Member, PRO Posts: 266
    That's pretty straightforward.
    Get the position of the tap and the position of the cannon.
    Do a magnitude function for distance.

    Use that as the velocity that the cannonball shoots. If the scale is not right, then adjust it. For example, if it is 100, but half that is more appropriate, do .5*(magnitude of the thing). If you desire some sort of curve (in many games like that, it's not linear, and the farther taps are much stronger than the close ones), then you could use a curve function.

    Good luck!
  • creativeappscreativeapps Member Posts: 1,770
    are you sure it will work? let me try thanks
Sign In or Register to comment.