This site requires JavaScript, please enable it in your browser!
Greenfoot back
CrazyGamer1122
CrazyGamer1122 wrote ...

2012/10/9

Enemy attacking randomly

CrazyGamer1122 CrazyGamer1122

2012/10/9

#
i am currently coding a fighting game where the player tries to beat a enemy, but i cannot make the enemy use random moves (strong kick, weak kick, weak punch, strong punch) and walk back and forth randomly. can anyone help me?
danpost danpost

2012/10/9

#
Is this a turn based scenario you are working on? If so, when enemy's turn call a method (from the world) to maybe do some proximity checking. If player not near, just move (with a small chance of turn). If player is near, turn towards and random chance fight, with random fighting action. If not turn based, just call the method from the act method of the enemy; and, maybe have a slight delay built in between fighting actions.
CrazyGamer1122 CrazyGamer1122

2012/10/9

#
thank you, i will add your suggestions to the code and see what happens :)
You need to login to post a reply.