VasiliyFamiliyaLe 29/03/2019 à 03:08
Now this code look like this:
if((RoxyX-x<=16)||(GyaruX-x<=16)) obstacle_right=1;
if((x-RoxyX<=16)||(x-GyaruX<=16)) obstacle_left=1;
if((y-RoxyY<=16)||(y-GyaruY<=16)) obstacle_up=1;
if((RoxyY-y<=16)||(GyaruY-y<=16)) obstacle_down=1;
//if(attacking==0)
//{
if((p1&JOY_UP)&&y>=176)
{
if((obstacle_up==0)&&(obstacle_left==0)&&(obstacle_right==0))
{
y--;
}
}
if((p1&JOY_DOWN)&&y<=220)
{
if((obstacle_down==0)&&(obstacle_left==0)&&(obstacle_right==0))
{
y++;
}
}
if((p1&JOY_LEFT)&&x>=32)
{
if((obstacle_left==0)&&(obstacle_up==0)&&(obstacle_down==0))
{
x--;
}
flipMode|=FLIP_X;
aSpriteSetFlip(&demoSpr,flipMode);
}
if((p1&JOY_RIGHT)&&x<=288)
{
if((obstacle_right==0)&&(obstacle_up==0)&&(obstacle_down==0))
{
x++;
}
flipMode&=~FLIP_X;
aSpriteSetFlip(&demoSpr,flipMode);
}if((p1&JOY_UP)&&((y<=112)&&(y>0)))
{
if((obstacle_up==0)&&(obstacle_left==0)&&(obstacle_right==0))
{
scrl_y--;
}
}
if((p1&JOY_DOWN)&&((y>=208)&&(y<224)))
{
if((obstacle_down==0)&&(obstacle_left==0)&&(obstacle_right==0))
{
scrl_y++;
}
}
if((p1&JOY_LEFT)&&((x<=32)&&(x>0)))
{
if((obstacle_left==0)&&(obstacle_up==0)&&(obstacle_down==0))
{
scrl_x--;
if (scrl_x>FRONT_MIN_X)
{
RoxyX++;
GyaruX++;
}
}
}
if((p1&JOY_RIGHT)&&((x>=288)&&(x<320)))
{
if((obstacle_right==0)&&(obstacle_up==0)&&(obstacle_down==0))
{
scrl_x++;
if (scrl_x<FRONT_MAX_X)
{
RoxyX--;
GyaruX--;
}
}
}
It became more readable and understandable, but bug wasn't removed.