Okay, so I’ve been making click games casually for a decent four years now and have only just discovered this community.
I feel like a bit of a tool for even posting this, because I’ve seen a handful of articles and forums on the topic... but something that I have never been able to figure out is 360 degree shooting.
Can anyone please help me out with a basic tutorial on how to make a weapon shoot in the direction of a mouse controlled crosshair?
Open source examples would be greatly appreciated… especially seeing as every other tutorial example I find has either a broken link, is completely useless, or needs a PhD in advanced mathematics to understand haha.
Any help would be greatly appreciated
(Oh, and im running MMF 1.5 if that’s relevant)
"This is you're life - and its ending one minute at a time"
First make crosshair then place hotspot into center. Now lets say you have your player or weapon. Now you have to place the crosshair into some distance. You can do this by setting the x-coord. with this formula:
Sin(AngleOfPlayer+90)*Distance+PlayerPosX
And Y-coord:
Cos(AngleOfPlayer+90)
Now you have to put hotspot of the player/gun into point, where the the bullet is going to start, and then just shoot object at direction of crosshair.
I have proven new mathematic formula to be true...
Originally Posted by NeoMonkey First make crosshair then place hotspot into center. Now lets say you have your player or weapon. Now you have to place the crosshair into some distance. You can do this by setting the x-coord. with this formula:
Sin(AngleOfPlayer+90)*Distance+PlayerPosX
And Y-coord:
Cos(AngleOfPlayer+90)
Now you have to put hotspot of the player/gun into point, where the the bullet is going to start, and then just shoot object at direction of crosshair.
any time you use "shoot object in direction of.." it only uses the built in 32 directions.
you have to use more math to actually make the bullet use 360degrees.
the bullet widget is the best thing to use if you already have mmf2. just use the wdget and all the work is already done for you. the math is in the bullets behavior.