add left animation for pipes

This commit is contained in:
Milang 2020-02-16 15:20:35 +01:00
parent 45a70614a0
commit de30485e46
5 changed files with 20 additions and 12 deletions

Binary file not shown.

View File

@ -12,8 +12,7 @@ static mkb_t keys[6]={0};
int mkb_getstate(mkb_t const k)
{
if (k!=MK_NONE)
return keys[k];
if (k!=MK_NONE) return keys[k];
return 0;
}

View File

@ -235,7 +235,6 @@ void mario_move()
{
c->number--;
score_add_coin();
score_add(200);
}
else if (c->content==2 && c->number)
{

View File

@ -64,6 +64,7 @@ void score_add_coin()
{
pieces++;
time_last_piece=time_id;
score_add(200);
}
void score_add(int i)

View File

@ -15,9 +15,9 @@ void set_teleporteurs(teleport_t const * const t, int const n)
if (t)
{
if (n>6)
nombre_teleporteurs=6;
nombre_teleporteurs=6;
else
nombre_teleporteurs=n;
nombre_teleporteurs=n;
if (nombre_teleporteurs)
{
memcpy(teleporteurs, t, sizeof(teleport_t)*n);
@ -33,11 +33,7 @@ void teleport_active()
teleport_t const t = teleporteurs[i];
if ((t.x==mario.p.x/8) && (t.y*8==mario.p.y || t.y*8==mario.p.y+mario.p.h))
{
if (t.key>=0)
{
if (!mkb_getstate(t.key))
continue;
}
if (!mkb_getstate(t.key)) continue;
// Animation section
if (t.key==MK_DOWN)
@ -66,9 +62,22 @@ void teleport_active()
}
}
if (t.key==MK_LEFT)
{
while (mario.p.x+mario.p.w>=8*t.x)
{
dclear(C_WHITE);
world_draw(0,0);
dupdate();
wait_next_frame(); // 10 fps
wait_next_frame();
mario.p.x--;
}
}
ResetMarioJump();
mario.p.x=t.tx*8+4; mario.p.y=t.ty*8;
mario.p.vx=0; mario.p.vy=0;
mario.p.x=t.tx*8+4; mario.p.y=t.ty*8; // Move Mario
mario.p.vx=0; mario.p.vy=0; // Disables every move of mario
camera_adjust();
}
}