View Single Post
  #29  
01-21-2013, 07:35 AM
Software Bug's Avatar
Software Bug
Formerly Tim Cottenham
 
: Jun 2004
: Groningen, Netherlands
: 1,068
Blog Entries: 1
Rep Power: 22
Software Bug  (308)Software Bug  (308)Software Bug  (308)Software Bug  (308)

Thank you! Well, the thing that's so great about Unity is that it already includes a ready-to-use physics system (albeit it can be glitchy at times!) so the only thing I had to do was to come up with a way to utilize it the way I wanted, like a slingshot.

That's done quite simple, by letting the players drag away from a specific point (in this case the sligshot tower) I can get the direction to shoot by inverting the way the player is dragging the Mudokon, so if you drag to the left, the direction to shoot is right, drag down, and the direction to shoot is up. Then I need to calculate what power to shoot with, and this can be done by measuring the distance between the center point and the mouse (withing pre-determined bounds so there is a max distance). I translate this distance to an amount of force, and add this force to the Mudokon, in the direction that I calculated. And then we just have to watch and enjoy the Mudokon smashing into things!
__________________
*Working on all the dead links around here, stay tuned!*

Throw around some Mudokons in my game Flying Mudokons!

Need images for your Oddworld fan project? Visit The Oddworld Vector Gallery!


Last edited by Software Bug; 01-21-2013 at 07:39 AM..
Reply With Quote