Make character escape from shot

Posted by M28 on Stack Overflow See other posts from Stack Overflow or by M28
Published on 2010-03-25T14:49:53Z Indexed on 2010/03/25 15:03 UTC
Read the original article Hit count: 372

Hello all math masters, I got a problem for you:

I have a 2D game (top down), and I would like to make the character escape from a shot, but not just walk away from the shot (I mean, don't be pushed by the shot), I want it to have a good dodging skills.

The variables are:

  • shotX - shot x position
  • shotY - shot y position
  • shotSpeedX - shot x speed
  • shotSpeedY - shot x speed
  • charX - character x position
  • charY - character y position
  • keyLeft - Set to true to make the character press the to left key
  • keyRight - Set to true to make the character press the to right key
  • keyUp - Set to true to make the character press the to up key
  • keyDown - Set to true to make the character press the down key

I can understand the following languages:

  • C/C++
  • Java
  • Actionscript 2/3
  • Javascript

© Stack Overflow or respective owner

Related posts about actionscript

Related posts about game-development