I put some turrets into the game I'm making, and I want it to fire directly at the player, but it only fires in 8 directions, so if you run at it from the wrong angle, it won't be able to hit you. How can I fix that?
How to make an enemy shoot directly at the player?
Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
-
-
I have more than one open source examples on my website of 360 degree shooting on my website. maybe one will help.
Marv
-
Quote from LemonyLime
I put some turrets into the game I'm making, and I want it to fire directly at the player, but it only fires in 8 directions, so if you run at it from the wrong angle, it won't be able to hit you. How can I fix that?
Can you upload the file? Post a link to it here and I'll fix it and send it back and you can see how it's done in the event editor.
-
Marv,.I just checked out your 360 Movement and Shoot Example engine (page 8). You are a math wiz for sure. Nice job....!!
-
It says I need the Advanced Direction Extension to open the Turret Follow Mouse Example (I'm hoping I can substitute the player in place of the mouse.) but I can't find it anywhere. It's not on the wiki list.
And all the extensions I've found so far don't work with TGF2, only MMF2.
-
Oh crap. That's right you can't use the 360 example, as it is, in TGF. Really sorry about that.
Check out this example:
Character 360 Direction ExampleIt is on page 19. Maybe you can adapt that.
Marv
-
Okay, I got it... I think it may be a bit beyond my abilities though, after a quick glance at it, but I'll give it a shot in the morning.
Thanks for your help.
-
I've mostly figured it out, but I'm not sure if this actually will do what I'm wanting.
I need the object to fire bullets directly at where the player is when the bullet is fired, not actually follow him completely.
This would be great for homing missiles or something though.
I guess just I need a version of this that sets the direction of the turret, rather than the angle. The same formula with direction, doesn't work.
-
all you need to do is:
make a large active object, (red circle i use)
at start of frame make this object invisable.
then for an event do this.
if (player) collides with (large active object)
have (large active object) launch (bullet) in direction of player relative to x0, y0.((then click in the corner it will say 1+1.))
-
That only makes it fire in 16 directions, I need it to fire in a full 360 directions, so it's perfectly accurate.
-
You can also do :
Always
- Bullet look in direction of playerThis will make a directional missile that will not miss the target.
-
Fudge Francois. Why didn't I think of that. I use this method using a boomarang on the return journey of it back to the player.
Marv
-
For proper 360 degree movement, you can set the angle of the bullet to:
and with the angle set, you can set the X position to
where 5 is your speed in pixels per frame, likewise for the Y position
In builds of MMF2 prior to 248, atan2 was not supported. I'm not sure if TGF2 has it at all, so for angle you would instead use:
-
Excellent Jacob, and thanks. So throw away the boomerang return way?
Marv
-
Yeah, it's not really needed if you want 360 degrees. Also, you can do the same by constantly setting the Angle to the formula above.
-
on the bottom of the directions on the sprite menu (Ya know, the square with the eight directions?) there is a little bar with a slider that goes left to right. The further right you pull it, the more directions you'll be able to have and make cleaner, more direct firing sequences. Just set it to look at the player, and it will fire automaticly.
-
You can also do :
Always
- Bullet look in direction of playerThis will make a directional missile that will not miss the target.
Doesn't work. It still only allows 32 directions.
-
sorry old thread...
-
Is there a way to do 360 degree aiming with Clickteam Bouncing Ball movement?
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!