I am trying to make one object shoot toward another object. The problem is that the accuracy of the shooter is terrible. What am i doing wrong? If i move to some positions he can fire spot on, but often its way to the left or right.
Printable View
I am trying to make one object shoot toward another object. The problem is that the accuracy of the shooter is terrible. What am i doing wrong? If i move to some positions he can fire spot on, but often its way to the left or right.
This is because MMF can only shoot in 32 directions, each one being 11.25 degrees apart so shooting 360 degrees is a problem. The way to handle this is, instead of Object A shooting a Bullet to Object B, do this...
In the Frame Editor, select the Bullet and apply Ball Movement to it. Give it the same speed as your bullets travel.
Now, in the Event Editor you change how Bullets are shot. When the player shoots, instead of Object A shooting the Bullet object, create a Bullet at Object A relative to the gun (point of shooting). Always set the Bullet to look At Object B. The Bullet will now travel to Object B, making a course direction as it goes (you won't notice this), and it will hit Object B.
If you want Object A to be able to shoot multiple objects (and not just Object B), you'll have to lay code for each object so each shot Bullet goes to its target.
Actually, I think his problem has to do with hotspots. Go into the image editor and check the hotspot on your target :)
Paul: Thanks! I will try that later and report back!
Riky: No i think Paul explained it with the 32 directons, checking the hotspots was the first thing i did :) But thanks for the input! :)
It's a common question. Try using the search button, there are lots of 360 degree shooting examples on the forum.
The 360 degree movement object may also be helpful.
link to extension forum
I've always found the Vector Movement to be the easiest way to shoot in 360-degrees. It's built-in to MMF, and you just need to give your object the Vector Movement and then control it via the Clickteam Movement Controller object. I can make an example if you need.
Please do if you can, i would be ver gratefull! :)Quote:
Originally Posted by Jaffob
I Hope its possible in my situation though. I have a caracter at the right side of the screen who stands still, his rifle will move up and down according to the angle the mouse is in, So i want a shot to be fired from the rifle toward where i have the mouse pointer, the crosshair.
Paul: I think the metod you described does not work in my case because the bullet should be shoot at the directon of the mouse pointer that is moving freely.
Here you go. :)
View MFA
Wow thanks that worked perfectly! :DQuote:
Originally Posted by Jaffob
One question only about the condition!, i have seen the condition "only one action when event loops" many times, but never understod what it does?
It basically stops the condition from running constantly if it's true. Try removing it from my example, and you will see that it shoots a thick stream of bullets if you hold down the mouse button. That condition stops this from happening. If you add it to the "Always" condition, it becomes almost the same as a "Start of Frame" condition. It's really useful for a lot of different things.