Be a Supporter!

Enemy AI for my game

  • 415 Views
  • 6 Replies
New Topic Respond to this Topic
K-A-H
K-A-H
  • Member since: Jan. 26, 2010
  • Offline.
Forum Stats
Member
Level 02
Gamer
Enemy AI for my game 2010-01-31 15:38:21 Reply

So now that i've gotten progress on the game(if you haven't seen it, go to my page for more info), i've stumbled onto a problem that i cannot get past. ENEMY AI!!!!

at first i got through the tutorials and tried coding on my own. i did not do so good. then i tried searching on the forums,and all i could find that made sense was 4 direction enemy ai. i need like a side scroller enemy ai descripion.

if anyone could explain to me how a side scroller enemy works, or guide me to a good enemy ai tutorial, it would be much appreciated.

JoeSkull
JoeSkull
  • Member since: Aug. 16, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Enemy AI for my game 2010-01-31 15:44:50 Reply

At 1/31/10 03:38 PM, K-A-H wrote: So now that i've gotten progress on the game(if you haven't seen it, go to my page for more info), i've stumbled onto a problem that i cannot get past. ENEMY AI!!!!

at first i got through the tutorials and tried coding on my own. i did not do so good. then i tried searching on the forums,and all i could find that made sense was 4 direction enemy ai. i need like a side scroller enemy ai descripion.

if anyone could explain to me how a side scroller enemy works, or guide me to a good enemy ai tutorial, it would be much appreciated.

It seems to me that the enemy in a sidescroller should always be moving towards the other side of the screen and either fire every so often or when ever it sees the player.

and if possible should randomly go up or down.


Be water my friend.
FlashGameMakers.ning.com
Real Flash Programmers + Real Flash Artists = Awesome Flash games

Treerung
Treerung
  • Member since: Apr. 18, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Enemy AI for my game 2010-01-31 15:53:07 Reply

Programming is an extension of basic logic..
If you can't understand how and why enemy AI works then you have no business coding it.
Some simple AI code would be along the lines of checking variables of the player ex(x and y) and having the enemy respond accordingly.


:'(

BBS Signature
Treerung
Treerung
  • Member since: Apr. 18, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Enemy AI for my game 2010-01-31 15:54:48 Reply

Also for a side scroller you would want to take a look at an attachMovie() tutorial for the enemy spawning.


:'(

BBS Signature
K-A-H
K-A-H
  • Member since: Jan. 26, 2010
  • Offline.
Forum Stats
Member
Level 02
Gamer
Response to Enemy AI for my game 2010-01-31 16:05:31 Reply

so if anything, i start with enemy spawning. alright, i'll go try that 1st.

K-A-H
K-A-H
  • Member since: Jan. 26, 2010
  • Offline.
Forum Stats
Member
Level 02
Gamer
Response to Enemy AI for my game 2010-01-31 17:01:28 Reply

now that i've went through attachMovie(); i've created a code that for some odd reason only works without the onClipEvent handler and the hitTest property.

onClipEvent(load){
if(this.hitTest(_root.hero)){
for(i=1;i<99;i++){
_root.attachMovie("Enemy1","NewEnemy1"+i , 1000+i);
_root["NewEnemy1"+i]._x=random(550);
_root["NewEnemy1"+i]._y=random(400);
}
}
}

can someone explain why this code does not work?

K-A-H
K-A-H
  • Member since: Jan. 26, 2010
  • Offline.
Forum Stats
Member
Level 02
Gamer
Response to Enemy AI for my game 2010-02-03 23:02:03 Reply

BUMP