add commands for the camera & slow down ennemies to their initial speed

dev
Milang 3 years ago
parent 8306be7e7a
commit 2547765eef
  1. BIN
      INIT/CasioRAM.mem
  2. 4
      SuperCbr.dlw
  3. BIN
      SuperCbr.g1a
  4. 43
      src/camera.c
  5. 3
      src/score.c

Binary file not shown.

@ -13,7 +13,7 @@ OptionA=0
[_2]
Type=1
Order=2
Order=1
Top=15
Left=7800
Height=6885
@ -25,7 +25,7 @@ OptionB=15
[_3]
Type=6
Order=1
Order=2
Top=4035
Left=2715
Height=6390

Binary file not shown.

@ -3,37 +3,26 @@
#include <mario.h>
#include <world.h>
#include <base.h>
#include <keyboard.h>
static int y=0;
int cameraX() {return min(max(mario.p.x-40,0),map_current->w*8-128);}
int cameraY() {return max(y-32,0);}
static int immobile=0;
static int last_vy=0;
static int immobile=0;
static int distance=0;
static int delta_y=0; // the player can choose the y positionning of the camera with arrows
int cameraX() {return min(max(mario.p.x-40,0),map_current->w*8-128);}
int cameraY() {return max(max(y-32,0)-delta_y,0);}
void cameraMove() // movement vertical seulement
void cameraMove() // only vertical movement
{
/* static int isMoving=0;
static int ref_y=0;
if (mario.p.y-cameraY()<16 || mario.p.y-cameraY()>56)
{
isMoving=1;
ref_y=mario.p.y;
}
if (isMoving)
{
for (int i=0; i<9; i++)
y+=sgn(mario.p.y-y);
if (y==ref_y)
isMoving=0;
}
*/
if (MKB_getKeyState(MK_UP) && abs(delta_y)<24) delta_y-=4;
if (MKB_getKeyState(MK_DOWN) && abs(delta_y)<24) delta_y+=4;
if (!MKB_getKeyState(MK_DOWN) && !MKB_getKeyState(MK_UP)) delta_y-=4*sgn(delta_y);
static int camera_vy=0;
if (mario.p.y==last_vy) // mario arrêté
immobile++;
immobile++;
else
{
last_vy=mario.p.y;
@ -54,13 +43,13 @@ void cameraMove() // movement vertical seulement
//décéleration après avoir parvouru la moitié de la distance, sinon acceleration
if (camera_vy*(camera_vy+1)>distance)
camera_vy--;
camera_vy--;
else
camera_vy++;
camera_vy++;
//y++;
if (camera_vy<0)
camera_vy=0;
camera_vy=0;
if (((y+camera_vy*sgn(mario.p.y-y)/2)-(mario.p.y))*sgn(mario.p.y-y)>0)
{
@ -68,7 +57,7 @@ void cameraMove() // movement vertical seulement
camera_vy=0;
}
else
y+=(camera_vy*sgn(mario.p.y-y))/2;
y+=(camera_vy*sgn(mario.p.y-y))/2;
}
last_vy=mario.p.y;

@ -107,8 +107,7 @@ void scoreDisplay()
sprintf(str, "c*%d", pieces);
dtext(50,0,str, C_BLACK, C_WHITE);
}
time_id++;
if (time_id%8==0)
{
time_left--;

Loading…
Cancel
Save