New Enemy Attack Strategy
Hi Everyone,
I am in the process of creating a boss for my game. The boss will be a big flying bat that will attack my character when he get a certain distance. The Bat will be flying all around the screen and when attacks he will spit out fireballs at my hero.
My guess is I will need two animations, a patrolling flying around animation and an attack animation. For the attack animation, the bat will will spawn the fire ball at my hero.
What is the best way to do this. I want the fire ball to come at my hero, but I don't know how to do it if the bat is flying in at a angle towards my hero. I tried using the accelerate toward behavior, but this turns it into more of a heat seeking fireball. I don't want the fireball to chase me, just fire at my direction so I can have the option to dodge it.
Any suggestions on how I should start my planning?
Comments
Put a change attribute into your fireball that says change attribute: rotation to vectorToAngle(game.PLAYERx-self.Position.x,game.PLAYERy-self.Position.Y). Then make a change velocity in your fireball and put the direction to 0. The vectorToAngle will point the fireball to the player ONCE, then the change velocity will move the fireball to towards the player
The vectorToAngle should work I just tested it and it worked fine for me.
Thanks I will give it a try!
@jdlcrater Awesome!! I think will this will work!
Cool! I am glad to help! And nice new profile pic! Looks cool