I started creating a game where a guy moves with an acceleration. I get to manage packages from the right but not those from the left. My algorithm is as follows:
It asks whether the 8 pixels on the right (or left) are put out. If so, we go to the following 8 pixels (more on the right or left). If a pixel is on, is stored (the difference between the abscissa of the pixel and the abscissa of the man) in the acceleration.
A is the horizontal acceleration
(X,Y) are the guy's coordonates
The routine works (right):
:Lbl DRO
:for(O,X+8,X+8+A
:For(Z,0,7
:If Pxl-Test(O,Z+Y
:O-8-X->A
:Return
:End
:End
:End
:Return
The routine that is the problem
:Lbl GAU
:O=X-1
:Repeat O=X+A-2
:For(Z,0,7
:If Pxl-Test(O,Z+Y
:O-X+1->A
:Return
:End
:End
:O-1->O
:End
:Return
Here I can't use a For( because I decrease O .
When my guy goes to a wall on the right, it is stopped against it and an acceleration of 0. But when he goes to a wall to the left, it passes through as if the routine did not work. I need help please!