supercasiobros/src/camera.c

26 lines
402 B
C
Raw Normal View History

2020-01-29 14:34:57 +01:00
#include <camera.h>
#include <mario.h>
#include <world.h>
#include <base.h>
static int y=0;
int camera_x() {return min(max(mario.p.x-40,0),map_current->w*8-128);}
2020-01-29 18:24:33 +01:00
int camera_y() {return max(y-24,0);}
2020-01-29 14:34:57 +01:00
2020-01-29 18:24:33 +01:00
void camera_move(int delay)
2020-01-29 14:34:57 +01:00
{
2020-01-29 18:24:33 +01:00
if (delay<=0)
delay=3; // on ajoute 1/3 de la distance camera mario
2020-01-29 14:34:57 +01:00
y+=(mario.p.y-y)/delay;
}
void camera_adjust()
{
y=mario.p.y;
}
void camera_reset()
{
y=0;
}