Author Topic: What kind of artificial inteligence should i use?  (Read 880 times)

mol

  • Member
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Hello, im making a beat´em up style kind of game and for the next step of it i need to have a lot of enemies on screen, ideally i would like the enemy distribution it to look something like castle crashers does

http://www.youtube.com/watch?v=6pT24MVcoAo&feature=related ( second 45 onwards is a great example of what i mean, there are a lot of enemies, but they are not swarming all over him all at the same time)

Here is an advance of what i´ve done so far

http://dl.dropbox.com/u/20459287/Proto.swf

(A-swing, S-bash, X-jump,Arrows-Movement)

As you can see the little demo_man (T'all you fine dandies so proud, so cock-sure, prancin' aboot with your heads full of eyeballs!) is just tryng to Hump on the player, the code goes something like this

Code: [Select]
private function moveSprite():void {
if(counter==0){
if(this.x-16>_prequijote.x){
facing = LEFT;
this.x -= shadow.speed;
}else{
facing = RIGHT;
this.x += shadow.speed;
}
if(this.y-16>_prequijote.y){
this.y -= shadow.speed;
}else{
this.y += shadow.speed;
}
}
counter = (counter + 1) % 3;
play("run");
}


where _prequijote is the sprite that the player uses, so, anyone has an idea on how could i improve this?

Thanks!




Chelnok

  • Contributor
  • ****
  • Posts: 257
  • Karma: +0/-0
    • View Profile
Re: What kind of artificial inteligence should i use?
« Reply #1 on: Tue, Oct 4, 2011 »
hmm.. i think you should create simple state machine with global enemy registry. In registry you need only couple vars like attackersMax and attackersAtTheMoment. And in state machine you do a check for attackers and all other things they do while they are attacking.

mol

  • Member
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: What kind of artificial inteligence should i use?
« Reply #2 on: Tue, Oct 4, 2011 »
hmm.. i think you should create simple state machine with global enemy registry. In registry you need only couple vars like attackersMax and attackersAtTheMoment. And in state machine you do a check for attackers and all other things they do while they are attacking.

Interesting idea, let me see how i work it out