   moving 2D image.....
  hi friends,I have stuck for this problem for 2 whole day, decided to find it on Google, then found this community here.Let's say, I create a 2D polygon image, and I want to move it around in my windows screen. Yes, I have successfully make it move by using its vector, but what I want is, the 2D image will go to other direction after its reach the edge of the screen, and move on, and after its reach at another edge, it will change it direction again and again, so its appear move around on the windows only.May I have some basic Idea on how to do this. Only the basic idea or suggestion on how to do this.Thanks.   
  Well use a Ai idea this is hypothetical and places an idea of logicFor you to work with.First exampleAction 1Action-patrolAction on activation go to action action 2Action 2Action-move to targetAction-attackAction - if targets lost go to action Action-action 1So in logic you know the directive and also the sub directive if Directive failsPut it to your workAction1Action -move curser upAction-if contact boundary 1 go to actionAction-action 2Action 2Action-move curser downAction-if contact boundary 2 go to actionAction-action 1So by stipulating a bounding box as a hole or in 4 segments you are able to control  direction threw actionHe he I hope that was an exciting way to make some thing simple sound complex ;  Thanks, and hey!...you are successfully make it complicated..:D, let me digest it first while waiting for the next solution....:D   ;  Do you want your 2D object to rotate?  If so, that would be a little more complicated.If you don't want it to rotate, check your leftmost point against the left of the screen ( probably 0 ) If your left most point is off the screen, then move your object back to the right by this much, and negate (0-x) the X component of your movement vector.Do this for all the other sides.   ;  You could inverse the velocity vector. VelVec.x *= -1; VelVec.y *= -1;if you mean that it should warp around the screen, you just have to change its position vector.if(PosVec.x > SCREEN_WIDTH) PosVec.x = 0;   