add specific comportement when a plateform is could pass trough mario
This commit is contained in:
parent
48625d4ce4
commit
e6ed094095
BIN
SuperCbr.g1a
BIN
SuperCbr.g1a
Binary file not shown.
|
@ -21,22 +21,23 @@ void reset_plateforme(plateforme_t* p)
|
|||
|
||||
void move_plateforme(plateforme_t* p)
|
||||
{
|
||||
|
||||
int xc = (mario.p.x<p->b.x+p->b.w && mario.p.x>=p->b.x) || (mario.p.x+mario.p.w<p->b.x+p->b.w && mario.p.x+mario.p.w>=p->b.x);
|
||||
int yc = (mario.p.y-3==p->b.y);
|
||||
|
||||
/*if (p->type==P_FALLING)
|
||||
// Si mario et la plateforme vont se chevaucher, la plateforme est immobilisée
|
||||
{
|
||||
if (p->v)
|
||||
p->v++;
|
||||
p->b.y+=p->v/2;
|
||||
}*/
|
||||
box_t b = p->b;
|
||||
b.x+=b.vx;
|
||||
b.y+=b.vy;
|
||||
int x_collide= (mario.p.x<=b.x && b.x<mario.p.x+mario.p.w) || (mario.p.x<=b.x+b.w-1 && b.x+b.w<mario.p.x+mario.p.w);
|
||||
int y_collide= (mario.p.y<=b.y && b.y<mario.p.y+mario.p.h) || (mario.p.y<=b.y+b.h-1 && b.y+b.h<mario.p.y+mario.p.h);
|
||||
if (x_collide&&y_collide)
|
||||
return;
|
||||
}
|
||||
|
||||
box_t temp=p->b;
|
||||
|
||||
box_move(&p->b);
|
||||
|
||||
|
||||
// Si mario est sur la plateforme, il bouge avec
|
||||
if (xc&&yc)
|
||||
if (((mario.p.x<p->b.x+p->b.w && mario.p.x>=p->b.x) || (mario.p.x+mario.p.w<p->b.x+p->b.w && mario.p.x+mario.p.w>=p->b.x)) && (mario.p.y-3==p->b.y))
|
||||
{
|
||||
box_t mario_clone=mario.p;
|
||||
mario_clone.vx=temp.vx;
|
||||
|
|
Loading…
Reference in New Issue