Update map
This commit is contained in:
parent
8d4b9a4dab
commit
8595dc6562
1 changed files with 26 additions and 32 deletions
58
game.cpp
58
game.cpp
|
@ -68,11 +68,11 @@ const signed char levelFloor[] =
|
||||||
40,16,12, 8, 4, 0,48, 0, 0, 0, 0, 0,24, 2,24, 8,24, 0, 0, 9, 9, 0,28,32,48, 2, 2, 2,24,
|
40,16,12, 8, 4, 0,48, 0, 0, 0, 0, 0,24, 2,24, 8,24, 0, 0, 9, 9, 0,28,32,48, 2, 2, 2,24,
|
||||||
40,20,48,48,48,48,48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0,24,32,40, 0, 0, 0,24,
|
40,20,48,48,48,48,48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0,24,32,40, 0, 0, 0,24,
|
||||||
40,24,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,32,48, 0, 0, 0,24,
|
40,24,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,32,48, 0, 0, 0,24,
|
||||||
40,28,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8,16,32,40, 0, 0, 0,24,
|
40,28,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8,12,16,32,40, 0, 0, 0,24,
|
||||||
40,32,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,32,32,32,32,32,48, 0, 0, 0,24,
|
40,32,32,32,32,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,32,32,32,32,32,48, 0, 0, 0,24,
|
||||||
40, 0,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8,-5,-2, 0, 0, 0, 0,24,
|
40, 0,48,40,40,40,40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8,-5,-2, 0, 0, 0, 0,24,
|
||||||
40, 0, 3,-8,-8,-8,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
40, 0,-3,-8,-8,-8,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32,-3,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
||||||
40, 0, 6,-8,-8,-8,32, 0, 0, 0,48,48, 0,48,48, 0, 0,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
40, 0,-6,-8,-8,-8,32, 0, 0, 0,48,48, 0,48,48, 0, 0,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
||||||
40, 0,48,-8,-8,-8,32,32,32,32,40, 1, 0, 1,40,32,32,32,32,32,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
40, 0,48,-8,-8,-8,32,32,32,32,40, 1, 0, 1,40,32,32,32,32,32,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
||||||
40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,36,32,36,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
||||||
40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
40, 0,48,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0,-8,-8,-8,-8,-8,-8,-8,-8, 0, 0, 0, 0, 0, 0,24,
|
||||||
|
@ -95,19 +95,19 @@ const signed char levelCeiling[] =
|
||||||
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,99,48,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,32,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,32,16,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,28,16,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
40,20,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24,
|
40,18,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24,
|
40,18,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
40,18,16,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
||||||
40,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
40,18,16,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
||||||
40,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
40,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
||||||
99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
99,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
||||||
99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
99,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,25,27,29,24,
|
||||||
99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24
|
99,24,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,24,24,24,24,24,24
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned char texture1[] =
|
const unsigned char texture1[] =
|
||||||
|
@ -679,9 +679,9 @@ public:
|
||||||
|
|
||||||
Character()
|
Character()
|
||||||
{
|
{
|
||||||
mCamera.position.x = 7807;//UNITS_PER_SQUARE * 1;
|
mCamera.position.x = 23295;//UNITS_PER_SQUARE * 1;
|
||||||
mCamera.position.y = 18489;//UNITS_PER_SQUARE * 5;
|
mCamera.position.y = 14593;//UNITS_PER_SQUARE * 5;
|
||||||
mCamera.direction = -3550;//200;
|
mCamera.direction = -3350;//200;
|
||||||
mCamera.height = UNITS_PER_SQUARE * 3;
|
mCamera.height = UNITS_PER_SQUARE * 3;
|
||||||
mCamera.resolution.x = 110 / SUBSAMPLE;
|
mCamera.resolution.x = 110 / SUBSAMPLE;
|
||||||
mCamera.resolution.y = 88;
|
mCamera.resolution.y = 88;
|
||||||
|
@ -835,7 +835,7 @@ int main()
|
||||||
|
|
||||||
p.display.load565Palette(&pal[0]); // load a palette the same way as any other palette in any other screen mode
|
p.display.load565Palette(&pal[0]); // load a palette the same way as any other palette in any other screen mode
|
||||||
p.display.persistence = 1;
|
p.display.persistence = 1;
|
||||||
p.setFrameRate(60);
|
p.setFrameRate(25);
|
||||||
p.display.setFont(fontTiny);
|
p.display.setFont(fontTiny);
|
||||||
|
|
||||||
while (p.isRunning())
|
while (p.isRunning())
|
||||||
|
@ -844,13 +844,12 @@ int main()
|
||||||
{
|
{
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
int16_t step = max(1,UNITS_PER_SQUARE / 15);
|
int16_t step = max(1,UNITS_PER_SQUARE / 7);
|
||||||
const int16_t step2 = max(UNITS_PER_SQUARE / 40,1);
|
const int16_t step2 = max(UNITS_PER_SQUARE / 25,1);
|
||||||
|
|
||||||
Vector2D d = angleToDirection(player.mCamera.direction);
|
Vector2D d = angleToDirection(player.mCamera.direction);
|
||||||
|
|
||||||
Vector2D moveOffset;
|
Vector2D moveOffset;
|
||||||
Unit heightOffset = player.mVericalSpeed;
|
|
||||||
|
|
||||||
moveOffset.x = 0;
|
moveOffset.x = 0;
|
||||||
moveOffset.y = 0;
|
moveOffset.y = 0;
|
||||||
|
@ -869,18 +868,14 @@ int main()
|
||||||
|
|
||||||
if (p.upBtn())
|
if (p.upBtn())
|
||||||
{
|
{
|
||||||
if (strafe)
|
if (lookUpDown)
|
||||||
heightOffset = step;
|
|
||||||
else if (lookUpDown)
|
|
||||||
player.mCamera.shear = min(player.mCamera.shear + 10,60);
|
player.mCamera.shear = min(player.mCamera.shear + 10,60);
|
||||||
else
|
else
|
||||||
moveOffset = d;
|
moveOffset = d;
|
||||||
}
|
}
|
||||||
else if (p.downBtn())
|
else if (p.downBtn())
|
||||||
{
|
{
|
||||||
if (strafe)
|
if (lookUpDown)
|
||||||
heightOffset = -step;
|
|
||||||
else if (lookUpDown)
|
|
||||||
player.mCamera.shear = max(player.mCamera.shear - 10,-60);
|
player.mCamera.shear = max(player.mCamera.shear - 10,-60);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -914,7 +909,7 @@ int main()
|
||||||
|
|
||||||
Unit prevHeight = player.mCamera.height;
|
Unit prevHeight = player.mCamera.height;
|
||||||
|
|
||||||
moveCameraWithCollision(&player.mCamera,moveOffset,heightOffset,
|
moveCameraWithCollision(&player.mCamera,moveOffset,player.mVericalSpeed,
|
||||||
floorHeightAt, ceilingHeightAt);
|
floorHeightAt, ceilingHeightAt);
|
||||||
|
|
||||||
Unit heightDiff = player.mCamera.height - prevHeight;
|
Unit heightDiff = player.mCamera.height - prevHeight;
|
||||||
|
@ -922,7 +917,6 @@ int main()
|
||||||
if (heightDiff == 0)
|
if (heightDiff == 0)
|
||||||
player.mVericalSpeed = 0; // hit floor/ceiling
|
player.mVericalSpeed = 0; // hit floor/ceiling
|
||||||
|
|
||||||
|
|
||||||
if (player.mVericalSpeed == 0 && p.bBtn())
|
if (player.mVericalSpeed == 0 && p.bBtn())
|
||||||
{
|
{
|
||||||
int16_t camX = divRoundDown(player.mCamera.position.x,UNITS_PER_SQUARE);
|
int16_t camX = divRoundDown(player.mCamera.position.x,UNITS_PER_SQUARE);
|
||||||
|
@ -930,10 +924,10 @@ int main()
|
||||||
|
|
||||||
if (player.mCamera.height - CAMERA_COLL_HEIGHT_BELOW -
|
if (player.mCamera.height - CAMERA_COLL_HEIGHT_BELOW -
|
||||||
floorHeightAt(camX,camY) < 2)
|
floorHeightAt(camX,camY) < 2)
|
||||||
player.mVericalSpeed = 200; // jump
|
player.mVericalSpeed = 400; // jump
|
||||||
}
|
}
|
||||||
|
|
||||||
player.mVericalSpeed -= 20; // gravity
|
player.mVericalSpeed -= 80; // gravity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue