|
|
Hi(gh)!
On 30.08.2015 19:29, clipka wrote:
> Your information about the #break statement is outdated since 2010-04-18 ;-)
>
> As of Perforce change 4942 (included in 3.7.beta.37 and later), you can
> also use #break in any #while, #loop or #macro block to leave the
> respective construct early.
But regardless whether I use #break or not, even in combination with
#else in the collision detection as showed here:
#declare rows=0; // check for collision with any stone
#while (rows < LevelLength)
#declare cols=0;
#while (cols < LevelWidth)
// #warning concat("row: ", str(rows, 1, 0), ", col: ", str (cols,
1, 0))
#if (layer2_array[rows][cols] = 1 | layer3_array[rows][cols] >= 20)
#declare xmin=cols-0.35;
#declare xmax=cols+1+0.35;
#declare zmin=rows-0.35;
#declare zmax=rows+1+0.35;
// horizontal obstacles
#if (ballpos_next.x >= xmin & ballpos_next.x <= xmax &
ballpos_next.z >= zmin & ballpos_next.z <= zmax & (ballpos.z < zmin |
ballpos.z > zmax))
#declare dir = 180-dir;
#declare hit=1;
#break
// #declare cols=LevelWidth;
// #declare rows=LevelLength; // loop is aborted
#else
#if (ballpos_next.x >= xmin & ballpos_next.x <= xmax & ballpos_next.z
>= zmin & ballpos_next.z <= zmax & (ballpos.x < xmin | ballpos.x > xmax))
#declare dir = -dir;
#declare hit=1;
#break
// #declare cols=LevelWidth;
// #declare rows=LevelLength; // loop is aborted
#end
#end
#end
#declare cols=cols+1;
#end
#if (hit)
#break
#end
#declare rows=rows+1;
#end
the ball keeps bouncing off a non-existent "horizontal" wall and then
moves right through the eastern wall!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
|