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

  • SLOCM3ZSLOCM3Z Member Posts: 797

    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

  • SLOCM3ZSLOCM3Z Member Posts: 797

    The vectorToAngle should work I just tested it and it worked fine for me.

  • quinn221quinn221 Member Posts: 280

    Thanks I will give it a try!

  • quinn221quinn221 Member Posts: 280

    @jdlcrater Awesome!! I think will this will work!

  • SLOCM3ZSLOCM3Z Member Posts: 797

    Cool! I am glad to help! And nice new profile pic! Looks cool

Sign In or Register to comment.