26 lines
402 B
C
26 lines
402 B
C
#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);}
|
|
int camera_y() {return max(y-24,0);}
|
|
|
|
void camera_move(int delay)
|
|
{
|
|
if (delay<=0)
|
|
delay=3; // on ajoute 1/3 de la distance camera mario
|
|
y+=(mario.p.y-y)/delay;
|
|
}
|
|
|
|
void camera_adjust()
|
|
{
|
|
y=mario.p.y;
|
|
}
|
|
|
|
void camera_reset()
|
|
{
|
|
y=0;
|
|
} |