05-06-2014, 04:34 PM
Just make use of the "rand()" function:
Of course you will end up having conditions if you don't want it to work awkwardly. The conditions are the base of the whole AI stuff.
|
AI-Code:
int randomval = rand(100); //returns an int b/w 0 & 100 if (randomval<=20) MoveOne(); if (randomval>20 && randomval<=40) MoveTwo(); if (randomval>40 && randomval<=60) MoveThree(); if (randomval>60 && randomval<=80) MoveThree(); if (randomval>80) MoveThree(); |
Of course you will end up having conditions if you don't want it to work awkwardly. The conditions are the base of the whole AI stuff.
![[Image: signature.png]](http://s3.postimg.org/wedqxlk3n/signature.png)
A-Engine: A new beat em up game engine inspired by LF2. Coming soon
A-Engine Dev Blog - Update #8: Timeout

Chat
