PDA

View Full Version : need help with ai



master_psin
October 25th, 2006, 09:03 AM
im making a fighting game and i need an opponent to fight back atm ive got
mc for standingin frame 1 walking frame2 and fighting frame 3-4 what type of code do i need so that he will walk and attack, and do damage?

SacrificialLamb
October 25th, 2006, 04:27 PM
is the game top down or side on?
for side on

if (char._x-range>enamy._x){
enamy.gotoAndStop(2)
enamy._x+=speed
} else if (char._x+range<enamy._x){
enamy.gotoAndStop(2)
enamy._x-=speed
} else if (char._x+range>enamy._x){
enamy.gotoAndStop(3)
}else if (char._x-range<enamy._x){
enamy.gotoAndStop(4)
}
some thing like this might work, or atlest is some where to start

(note; my speelchek is not working. supid MSword)

woad
October 25th, 2006, 11:37 PM
Go here for a fighting tut:

http://www.how2flash.com/tutorials/Fighting Game/

evildrummer
October 26th, 2006, 05:48 AM
just have checks saying, if too far away, move towards, if in range, randomise attack or defend, theres a simple fighting AI,