Jump to content

moveToObject and ?


Heppell08
 Share

Recommended Posts

I wrote a whole script until the page killed it lol.

 

Anyway:

 

Im making a topdown shooter, theres a "tank" and a bunch of different enemies. I have a piece of code that resets the enemy spawns on randomX/Y. This all works perfectly but there is a major flaw in myy gameplay. You can kite the enemies in a circle and then have them all group up into what can only be described as a single OP health enemy you can keep shooting to kill the enemies. 

I would really prefer to have the enemies not just converge onto the player in the fashion they already do but to also have some sort of none enemy grouping chase if that makes sense?

 

If you want to see the game i can upload my latest build to dropbox.

Link to comment
Share on other sites

I'd suggest you Google for 'javascript flocking' or maybe 'javascript boids' and get a feel for what's involved in this kind of behaviour. I think the example I posted breaks it down pretty clearly though; you don't necessarily have to extend the sprites - though it is the best way to do this kind of thing.

Link to comment
Share on other sites

Yeah i had a google around. Alot of mind melting stuff when it comes to looking at the math involved but i finally got there. I actually had an underlying bug i didn't know of until today and it was my spritesheet was causing my .body to offset from the image quite a bit which cause huge conflict when testing.

luckily i spotted it and got it working quite nicely. Thanks :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...