Add shots
This commit is contained in:
parent
70383a8b29
commit
a53c357ac3
1 changed files with 109 additions and 197 deletions
306
demo2.cpp
306
demo2.cpp
|
@ -17,12 +17,7 @@
|
|||
|
||||
Player player;
|
||||
|
||||
#define SPRITES 3
|
||||
#define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE
|
||||
|
||||
#define JUMP_SPEED 500
|
||||
|
||||
Sprite sprites[SPRITES];
|
||||
#define SHOT_SPEED 5 * UNITS_PER_SQUARE
|
||||
|
||||
const unsigned char level[] =
|
||||
{
|
||||
|
@ -394,160 +389,82 @@ const unsigned char texture4[] =
|
|||
,0x09,0x09,0x59,0x09
|
||||
};
|
||||
|
||||
const unsigned char sprite1[] =
|
||||
const unsigned char spritePlasma[] =
|
||||
{ 32, 32 // width, height
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x00,0x00,0x00,0x64,0x64,0x64,0x76,0x64,0x64,0x64,0x64,0x64,0x00,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x00,0x00,0x64,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x09,0x09,0x09
|
||||
,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x52,0x76,0x76,0x64
|
||||
,0x52,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x76,0x64,0x00,0x09,0x09,0x09
|
||||
,0x09,0x09,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x52
|
||||
,0x09,0x76,0x52,0x64,0x52,0x00,0x07,0x07,0x07,0x00,0xff,0x76,0x09,0x09
|
||||
,0x52,0x09,0x52,0x09,0x09,0x52,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x00,0x76,0x76,0x64,0x52,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0xff
|
||||
,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x52,0x52,0x52,0x52,0x00,0x00,0x07
|
||||
,0x07,0x07,0x07,0x00,0x52,0x76,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00
|
||||
,0x07,0x00,0x76,0x52,0x52,0x64,0x64,0x52,0x52,0x52,0x52,0x64,0x52,0x64
|
||||
,0x64,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x09,0x76,0x09,0x64,0x52,0x76
|
||||
,0x09,0x64,0x52,0x00,0x00,0x76,0x64,0x00,0x00,0x00,0x00,0x00,0x64,0x52
|
||||
,0x52,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x09,0x64
|
||||
,0x52,0x64,0x52,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x07,0x07,0x07
|
||||
,0x07,0x07,0x00,0x64,0x52,0x52,0x52,0x00,0x00,0x00,0x07,0x07,0x07,0x07
|
||||
,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x64,0x52,0x52,0x52,0x00,0x07,0x00
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x52,0x00,0x00,0x76,0x76
|
||||
,0x00,0x07,0x07,0x07,0x00,0x64,0x09,0x76,0x52,0x64,0x09,0x76,0x09,0x52
|
||||
,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x09
|
||||
,0x00,0x76,0x64,0x00,0x00,0x07,0x07,0x07,0x00,0x52,0x00,0x76,0x09,0x52
|
||||
,0x09,0x64,0x52,0x64,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x64,0x76,0x64
|
||||
,0x00,0x07,0x00,0x09,0x76,0x64,0x76,0x00,0x76,0x00,0x07,0x00,0x64,0x64
|
||||
,0x09,0x64,0x52,0x64,0x09,0x76,0x52,0x64,0x52,0x00,0x00,0xff,0x00,0x00
|
||||
,0x76,0x00,0x00,0x64,0x64,0x00,0x52,0x52,0x64,0x00,0x00,0x76,0x64,0x64
|
||||
,0x00,0x64,0x00,0x00,0x09,0x76,0x09,0x64,0x09,0x76,0x52,0x52,0x52,0x00
|
||||
,0x07,0x00,0x76,0x76,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x64,0x52,0x64
|
||||
,0x64,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x09,0x64,0x09,0x52,0x00,0x76
|
||||
,0x09,0x64,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x07,0x00,0x64,0x52
|
||||
,0x64,0x52,0x52,0x64,0x64,0x00,0x07,0x07,0x00,0x07,0x00,0x52,0x09,0x64
|
||||
,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x00,0x00,0x07,0x07
|
||||
,0x07,0x00,0x64,0x52,0x64,0x52,0x52,0x52,0x64,0x00,0x07,0x07,0x00,0x07
|
||||
,0x00,0x52,0x00,0x64,0x09,0x64,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x00
|
||||
,0x64,0x64,0x00,0x07,0x07,0x00,0x52,0x00,0x09,0x64,0x52,0x52,0x52,0x64
|
||||
,0x00,0x00,0x64,0x00,0x00,0x09,0x00,0x76,0x09,0x52,0x00,0x76,0x09,0x52
|
||||
,0x52,0x00,0x00,0x64,0x00,0x00,0x64,0x00,0x00,0x52,0x64,0x00,0x52,0x52
|
||||
,0x64,0x00,0x00,0x64,0x64,0x64,0x00,0x64,0x00,0x00,0x00,0x64,0x09,0x52
|
||||
,0x00,0x64,0x52,0x52,0x52,0x00,0x07,0x00,0x07,0x07,0x00,0x52,0x64,0x52
|
||||
,0x00,0x07,0x00,0x09,0x64,0x64,0x64,0x00,0x64,0x00,0x07,0x00,0x64,0x64
|
||||
,0x00,0x64,0x09,0x52,0x00,0x64,0x09,0x64,0x52,0x00,0x07,0x07,0x07,0x07
|
||||
,0x07,0x00,0x00,0x00,0x07,0x00,0x64,0x00,0x00,0x64,0x52,0x00,0x00,0x07
|
||||
,0x07,0x07,0x00,0x52,0x09,0x64,0x52,0x52,0x00,0x64,0x52,0x52,0x52,0x00
|
||||
,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x64,0x00,0x00,0x00
|
||||
,0x64,0x64,0x00,0x07,0x07,0x07,0x00,0x64,0x00,0x64,0x09,0x52,0x00,0x52
|
||||
,0x09,0x52,0x52,0x00,0x00,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x64
|
||||
,0x00,0x00,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x52
|
||||
,0x52,0x52,0x00,0x64,0x09,0x52,0x52,0x00,0x00,0x64,0x64,0x00,0x00,0x00
|
||||
,0x00,0x00,0x64,0x00,0x00,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07
|
||||
,0x00,0x00,0x00,0x64,0x09,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x00
|
||||
,0x64,0x00,0x09,0x52,0x52,0x52,0x09,0x09,0x52,0x09,0x52,0x52,0x52,0x52
|
||||
,0x52,0x00,0x00,0x07,0x00,0x09,0x00,0x52,0x09,0x52,0x00,0x52,0x52,0x52
|
||||
,0x52,0x00,0x07,0x07,0x00,0x64,0x00,0x09,0x09,0x09,0x09,0x09,0x09,0x09
|
||||
,0x09,0x09,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x09,0x64,0x52,0x52
|
||||
,0x00,0x64,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x00,0x64,0x64,0x00,0x09
|
||||
,0x09,0x52,0x09,0x09,0x09,0x09,0x52,0x00,0x00,0x07,0x07,0x07,0x07,0x07
|
||||
,0x00,0x52,0x52,0x52,0x00,0x52,0x09,0x52,0x52,0x00,0x07,0x07,0x07,0x07
|
||||
,0x00,0x00,0x64,0x64,0x09,0x09,0x09,0x52,0x09,0x52,0x09,0x00,0x00,0x00
|
||||
,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x64,0x52,0x52,0x52,0x00
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x64,0x64,0x09,0x09,0x52,0x09
|
||||
,0x52,0x09,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x00,0x00,0x09,0x52
|
||||
,0x52,0x52,0x52,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00
|
||||
,0x64,0x64,0x64,0x09,0x09,0x09,0x09,0x09,0x00,0x00,0x00,0x00,0x07,0x07
|
||||
,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x64,0x64,0x64,0x64,0x64,0x64,0x64
|
||||
,0x64,0x64,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07
|
||||
};
|
||||
|
||||
const unsigned char sprite2[] =
|
||||
{ 32, 32 // width, height
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0xbf,0xbf
|
||||
,0xbf,0x00,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x27,0x00,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x00,0xbf,0x5b,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x27,0x27
|
||||
,0x0c,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x00,0x52,0x6d,0x5b,0x09,0x0c,0x0c,0x0c,0x27,0x27
|
||||
,0x27,0x0c,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x00,0x07,0x00,0x5b,0x09,0x09,0x09,0x0a,0x0a
|
||||
,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0b,0x0b,0x0a,0x00,0x07,0x07,0x00,0x00
|
||||
,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x3f,0x00,0x5b,0x09,0x5b
|
||||
,0x09,0x00,0x02,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x00
|
||||
,0x00,0x07,0x00,0x3e,0xb6,0x00,0x07,0x00,0x07,0x07,0x07,0x00,0x15,0x15
|
||||
,0x3d,0x09,0x09,0x09,0x00,0x01,0x01,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x01
|
||||
,0x01,0x01,0x01,0x52,0x52,0x00,0x07,0x00,0x3e,0x6d,0x00,0xb6,0x00,0x07
|
||||
,0x00,0x0c,0x0c,0x15,0x15,0x3d,0x00,0x00,0x0a,0x0a,0x00,0x00,0x00,0x01
|
||||
,0x01,0x01,0x01,0x01,0x01,0x01,0x52,0x6d,0x52,0x00,0x07,0x07,0x00,0x3d
|
||||
,0x5b,0x6d,0x00,0x00,0x27,0x27,0x0c,0x0c,0x15,0x3f,0x00,0x01,0x00,0x00
|
||||
,0x09,0x00,0x52,0x00,0x09,0x00,0x00,0x00,0x01,0x01,0x09,0xb6,0x09,0x00
|
||||
,0x07,0x07,0x07,0x00,0x3d,0x09,0x00,0x0a,0x0c,0x15,0x27,0x09,0x09,0x09
|
||||
,0x09,0x00,0x3f,0x00,0x52,0x09,0x64,0x00,0x3d,0x3d,0x3f,0x64,0x64,0x09
|
||||
,0xb6,0x6d,0x09,0x00,0x07,0x07,0x00,0xbf,0x6d,0x00,0x5b,0x52,0x0a,0x09
|
||||
,0x09,0x09,0x5b,0x6d,0x09,0x5b,0x3d,0x00,0x64,0x00,0x64,0x09,0x00,0x1d
|
||||
,0x3f,0x5b,0x52,0x52,0x09,0x52,0x00,0x00,0x07,0x00,0xb6,0xff,0x3e,0x00
|
||||
,0x3e,0x3e,0x3d,0x09,0x5b,0x6d,0xbf,0xb6,0x52,0x3e,0x1d,0x3d,0x00,0x64
|
||||
,0x00,0x52,0x00,0x00,0x09,0x52,0x52,0x12,0x09,0x00,0x00,0x00,0x00,0x3d
|
||||
,0x3d,0x3d,0x00,0x00,0x00,0x00,0x09,0x09,0x09,0x6d,0x6d,0x52,0x52,0x3e
|
||||
,0x1d,0x3d,0x00,0x64,0x00,0x52,0x00,0x02,0x00,0x00,0x09,0x00,0x00,0x01
|
||||
,0x00,0x00,0x07,0x00,0x52,0x5b,0x3d,0x00,0x3d,0x3f,0x3f,0x09,0x5b,0x52
|
||||
,0x5b,0x6d,0x52,0x3d,0x1d,0x3f,0x00,0x64,0x00,0x52,0x00,0x01,0x01,0x01
|
||||
,0x01,0x0a,0x0a,0x0a,0x00,0x00,0x07,0x07,0x00,0x52,0x5b,0x00,0x52,0x52
|
||||
,0x0a,0x27,0x09,0x09,0x09,0x09,0x52,0x5b,0x3f,0x00,0x00,0x64,0x00,0x52
|
||||
,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x07,0x07,0x07,0x07,0x00
|
||||
,0x3f,0x09,0x00,0x0a,0x0c,0x27,0x0c,0x15,0x3f,0x09,0x09,0x09,0x3f,0x00
|
||||
,0x64,0x00,0x52,0x09,0x00,0x3d,0x3f,0x5b,0x00,0x00,0x01,0x01,0x00,0x07
|
||||
,0x07,0x07,0x00,0x1d,0x52,0x5b,0x00,0x0c,0x27,0x0c,0x0c,0x15,0x0c,0x3d
|
||||
,0x00,0x00,0x00,0x00,0x52,0x09,0x00,0x00,0x3f,0x3e,0x3d,0x52,0x52,0x64
|
||||
,0x09,0x52,0x00,0x00,0x07,0x00,0x1d,0x5b,0x00,0x5b,0x00,0x27,0x0c,0x0c
|
||||
,0x15,0x15,0x15,0x3d,0x52,0x52,0x0a,0x52,0xbf,0x6d,0x00,0x00,0x00,0x3f
|
||||
,0x52,0x12,0x12,0x09,0x64,0xb6,0x52,0x00,0x00,0x3f,0x5b,0x00,0x07,0x00
|
||||
,0x07,0x00,0x00,0x0c,0x27,0x15,0x15,0x3e,0x00,0x09,0x52,0xbf,0x6d,0x5b
|
||||
,0x0a,0x0a,0x0a,0x01,0x00,0x00,0x00,0x00,0x00,0x64,0x09,0x00,0x00,0x00
|
||||
,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x27,0x3e,0x27,0x27,0x15
|
||||
,0x09,0x00,0x00,0x0a,0x0a,0x0a,0x0a,0x0a,0x01,0x01,0x01,0x00,0x00,0x09
|
||||
,0x09,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00
|
||||
,0x3d,0x0c,0x0c,0x27,0x27,0x27,0x27,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a
|
||||
,0x01,0x01,0x01,0x0a,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x27,0x27,0x27
|
||||
,0x27,0x15,0x15,0x0a,0x0a,0x0a,0x0a,0x0a,0x00,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,0x15,0x15,0x15,0x00,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00
|
||||
,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x58,0x58,0x07,0x10,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x48,0x48,0x58,0x10,0x58,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x60,0x58,0x58,0x07,0x48,0x07
|
||||
,0x07,0x07,0x07,0x07,0x48,0x07,0x07,0x07,0x07,0x10,0x60,0x60,0x58,0x58
|
||||
,0x58,0x60,0x58,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x58
|
||||
,0x58,0x60,0x58,0x58,0x07,0x07,0x07,0x07,0x07,0x58,0x07,0x07,0x58,0x58
|
||||
,0xa8,0x58,0x58,0x58,0x60,0xb0,0xa9,0x58,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x58,0x58,0x60,0xb0,0xb0,0x60,0x58,0x10,0x07,0x07,0x48,0x48
|
||||
,0x10,0x07,0x58,0x60,0x60,0xa8,0x07,0x10,0x07,0x60,0x60,0x60,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x48,0x60,0x60,0x60,0x60,0x58,0x58,0x07
|
||||
,0x07,0x07,0x10,0x07,0x58,0x58,0x60,0x60,0xa8,0x58,0x10,0x07,0x08,0x07
|
||||
,0x60,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x10,0x58,0x58
|
||||
,0x48,0x07,0x07,0x10,0x07,0x07,0x07,0x58,0x58,0xa8,0x60,0xb1,0x58,0x59
|
||||
,0x07,0x07,0x07,0x07,0x10,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x48,0x07,0x07,0x07,0x07,0x58,0x07,0x07,0x60,0xa8,0xb0
|
||||
,0xb1,0xb1,0xb1,0x58,0x10,0x07,0x07,0x10,0x58,0x60,0x07,0x58,0x58,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x10,0x58,0x10,0x07,0x07,0x07,0x07,0x58,0x07
|
||||
,0x07,0x58,0x58,0xa8,0xb1,0xbb,0xb1,0xa9,0x60,0x58,0x07,0x58,0x60,0x60
|
||||
,0xa8,0x60,0x60,0x07,0x07,0x07,0x07,0x07,0x07,0x10,0x58,0x07,0x07,0x07
|
||||
,0x07,0x58,0x58,0x58,0x07,0x58,0x60,0xa8,0xb1,0xbb,0xb1,0x69,0xa8,0xa8
|
||||
,0x60,0x61,0x60,0xa9,0x58,0xa8,0x58,0x58,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x48,0x07,0x07,0x07,0x58,0x07,0x07,0x58,0x60,0x60,0x69,0xb1,0xb1
|
||||
,0xb1,0x69,0xb1,0x69,0x69,0x60,0xa8,0x60,0x58,0x10,0x58,0x07,0x07,0x07
|
||||
,0x07,0x07,0x48,0x07,0x07,0x07,0x07,0x07,0x48,0x10,0x07,0x08,0x60,0xb0
|
||||
,0xb1,0xb1,0xb1,0xb1,0xa8,0x69,0xb1,0xb1,0xb0,0xa8,0x58,0x60,0x07,0x07
|
||||
,0x58,0x07,0x07,0x07,0x07,0x58,0x07,0x07,0x07,0x07,0x07,0x58,0x07,0x07
|
||||
,0x48,0xa8,0xb1,0xb1,0xb1,0xb3,0xb1,0xb1,0xb1,0xb0,0xb1,0xb1,0xb1,0x60
|
||||
,0x60,0x07,0x07,0x58,0x58,0x58,0x07,0x07,0x07,0x48,0x58,0x07,0x07,0x07
|
||||
,0x08,0x07,0x58,0x58,0x60,0xb1,0xb2,0xb1,0xb1,0xb1,0xbb,0xbb,0xb1,0xb1
|
||||
,0xb1,0x69,0xb1,0x60,0x58,0x07,0x07,0x58,0xa9,0x61,0x48,0x07,0x07,0x58
|
||||
,0x10,0x58,0x60,0x07,0x07,0x58,0x58,0x60,0x69,0xb1,0xb1,0xb1,0xb1,0xb9
|
||||
,0xbc,0xbc,0xbb,0xb1,0xb1,0xb1,0x69,0xb1,0x60,0x58,0x58,0xa8,0x69,0xb1
|
||||
,0x58,0x58,0x58,0x58,0x07,0x60,0xb0,0x58,0x10,0x48,0x60,0x60,0xb1,0xb1
|
||||
,0xb1,0xb1,0xb2,0xbb,0xbc,0xbd,0xbb,0xbb,0xb1,0xb1,0xb1,0xb1,0x60,0x60
|
||||
,0x58,0x58,0xb1,0x69,0x69,0x58,0xa8,0x60,0x58,0x58,0xa8,0x58,0x07,0x58
|
||||
,0x60,0xb0,0xb1,0xb2,0xb9,0xb1,0xbb,0xbb,0xbe,0xbc,0xbe,0xbc,0xb9,0xb1
|
||||
,0xb1,0x69,0xb1,0x60,0x58,0x60,0xb0,0xb1,0xb0,0xb1,0xb0,0xa9,0x07,0x60
|
||||
,0x58,0x58,0x07,0x07,0x48,0x58,0xa8,0xb1,0xb1,0xb1,0xb1,0xb1,0xb9,0xbc
|
||||
,0xbc,0xb9,0xb1,0xb1,0x69,0xb1,0x69,0x60,0x58,0x60,0xa8,0x60,0x61,0x60
|
||||
,0x60,0x58,0x07,0x48,0xa8,0x58,0x58,0x58,0x07,0x07,0x58,0x69,0xb1,0xb1
|
||||
,0xb1,0xb1,0xbb,0xb9,0xbb,0xbb,0xb2,0xb1,0x69,0x69,0xa9,0x58,0x58,0x48
|
||||
,0x58,0x60,0x60,0x60,0x48,0x58,0x07,0x07,0x48,0x58,0x58,0x58,0x07,0x07
|
||||
,0x10,0x60,0xb1,0xb1,0xb1,0xb1,0xb9,0xbb,0xbb,0xb1,0xb9,0xb1,0x69,0xb1
|
||||
,0x60,0x58,0x07,0x48,0x60,0x58,0x60,0x58,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x58,0x58,0x07,0x07,0x48,0xa8,0xb1,0xb1,0xb1,0x69,0xbb,0xbb,0xb1,0xb1
|
||||
,0xb1,0xb1,0xb1,0xa9,0x69,0x58,0x07,0x07,0x48,0x58,0x58,0x58,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x48,0x07,0x07,0x07,0x58,0xb0,0xb1,0xa9,0x69,0xb1
|
||||
,0xb9,0xbb,0xb2,0xb1,0xb1,0xb1,0xb1,0x69,0x69,0x48,0x07,0x48,0x07,0x60
|
||||
,0x58,0x58,0x07,0x07,0x07,0x07,0x07,0x58,0x58,0x10,0x07,0x07,0x48,0x60
|
||||
,0x60,0xb0,0xb1,0x69,0xb1,0xb1,0xb1,0xb1,0x69,0xb0,0xb0,0x69,0xb0,0x58
|
||||
,0x07,0x07,0x58,0x60,0x60,0x58,0x07,0x07,0x07,0x07,0x48,0xa8,0x58,0x58
|
||||
,0x07,0x07,0x58,0x60,0x60,0xa8,0xb0,0xb1,0xb1,0xb1,0xb1,0xb0,0xa8,0x58
|
||||
,0x58,0x60,0xa8,0x58,0x07,0x07,0x58,0x58,0x60,0x58,0x07,0x07,0x07,0x07
|
||||
,0x60,0xa8,0x60,0x10,0x07,0x07,0x07,0x58,0x58,0x58,0x60,0xb1,0x69,0x69
|
||||
,0xb1,0x69,0x58,0x07,0x07,0x58,0x48,0x07,0x07,0x07,0x60,0x58,0x58,0x07
|
||||
,0x07,0x07,0x07,0x58,0x60,0x60,0x60,0x58,0x07,0x07,0x48,0x58,0x58,0x10
|
||||
,0x60,0x69,0xb0,0xb0,0xb1,0x69,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x58
|
||||
,0x58,0xa8,0x58,0x07,0x07,0x07,0x07,0x07,0x58,0x58,0xa8,0x58,0x07,0x07
|
||||
,0x10,0x58,0x07,0x10,0x60,0xa8,0x60,0x69,0xa9,0xb0,0x58,0x10,0x58,0x58
|
||||
,0x07,0x07,0x10,0x60,0xa8,0x60,0x58,0x58,0x58,0x07,0x07,0x07,0x07,0x60
|
||||
,0x60,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x58,0x59,0x60,0x60,0x60
|
||||
,0x58,0x07,0x58,0x58,0x58,0x58,0x07,0x60,0x58,0x10,0x48,0x58,0x58,0x07
|
||||
,0x07,0x07,0x07,0x48,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x48,0x60
|
||||
,0x58,0x58,0x58,0x10,0x07,0x07,0x58,0x58,0x58,0x60,0x58,0x48,0x10,0x07
|
||||
,0x07,0x07,0x07,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x10,0x07,0x60,0x10,0x48,0x07,0x07,0x07,0x07,0x07,0x58,0x58
|
||||
,0x60,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x10,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x58,0x60,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x58,0x58,0x60,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07
|
||||
,0x07,0x07,0x07,0x07,0x07,0x58,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x60
|
||||
,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x58,0x10,0x07,0x07,0x07,0x07,0x07
|
||||
,0x48,0x07
|
||||
};
|
||||
|
||||
const unsigned char *textures[] = {texture1, texture2, texture3, texture4};
|
||||
|
@ -571,6 +488,10 @@ Unit textureAt(int16_t x, int16_t y)
|
|||
|
||||
uint8_t cFloor, cCeiling;
|
||||
|
||||
Vector2D shotPosition;
|
||||
Vector2D shotDirection;
|
||||
bool shotFired = false;
|
||||
|
||||
/**
|
||||
Function for drawing a single pixel (like fragment shader).
|
||||
*/
|
||||
|
@ -610,41 +531,14 @@ void draw()
|
|||
|
||||
render(player.mCamera,floorHeightAt,0,textureAt,pixelFunc,c);
|
||||
|
||||
Unit previousDepth;
|
||||
|
||||
/*
|
||||
// draw sprites
|
||||
|
||||
for (uint8_t i = 0; i < SPRITES; ++i)
|
||||
if (shotFired)
|
||||
{
|
||||
if (dist(sprites[i].mPosition,player.mCamera.position) > SPRITE_MAX_DISTANCE)
|
||||
continue;
|
||||
PixelInfo pos = mapToScreen(shotPosition,UNITS_PER_SQUARE,player.mCamera);
|
||||
|
||||
PixelInfo pos = mapToScreen(sprites[i].mPosition,sprites[i].mHeight,player.mCamera);
|
||||
|
||||
if (pos.depth > 0)
|
||||
drawSprite(sprites[i].mImage,pos.position.x * SUBSAMPLE,pos.position.y,
|
||||
pos.depth,perspectiveScale(sprites[i].mPixelSize,pos.depth));
|
||||
|
||||
if (i != 0 && pos.depth > previousDepth)
|
||||
{
|
||||
Sprite tmp = sprites[i];
|
||||
sprites[i] = sprites[i - 1];
|
||||
sprites[i - 1] = tmp;
|
||||
}
|
||||
|
||||
previousDepth = pos.depth;
|
||||
drawSprite(spritePlasma,pos.position.x * SUBSAMPLE,
|
||||
pos.position.y,pos.depth,
|
||||
perspectiveScale(64,pos.depth));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
pokitto.display.setColor(rgbToIndex(7,7,3));
|
||||
pokitto.display.setCursor(1,1);
|
||||
pokitto.display.print(player.mCamera.position.x);
|
||||
pokitto.display.print(" ");
|
||||
pokitto.display.print(player.mCamera.position.y);
|
||||
pokitto.display.print(" ");
|
||||
pokitto.display.print(player.mCamera.direction);
|
||||
*/
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -657,11 +551,6 @@ int main()
|
|||
player.setPositionSquare(6,5);
|
||||
player.mCamera.height = CAMERA_COLL_HEIGHT_BELOW;
|
||||
|
||||
sprites[0] = Sprite(sprite1,10,5,1,100);
|
||||
sprites[1] = Sprite(sprite1,14,5,1,100);
|
||||
sprites[2] = Sprite(sprite2,15,19,1,150);
|
||||
sprites[2].mHeight -= UNITS_PER_SQUARE / 2;
|
||||
|
||||
uint32_t previousTime = 0;
|
||||
uint32_t dt;
|
||||
|
||||
|
@ -675,11 +564,34 @@ int main()
|
|||
dt = timeNow - previousTime;
|
||||
previousTime = timeNow;
|
||||
|
||||
int16_t horizontalStep = (dt * PLAYER_SPEED) / 1000;
|
||||
int16_t horizontalStep = (dt * PLAYER_SPEED * (pokitto.bBtn() ? 2 : 1)) / 1000;
|
||||
int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
|
||||
|
||||
Vector2D d = angleToDirection(player.mCamera.direction);
|
||||
|
||||
if (shotFired)
|
||||
{
|
||||
// update the shot
|
||||
|
||||
Unit shotStep = (dt * SHOT_SPEED) / 1000;
|
||||
|
||||
shotPosition.x += (shotStep * shotDirection.x) / UNITS_PER_SQUARE;
|
||||
shotPosition.y += (shotStep * shotDirection.y) / UNITS_PER_SQUARE;
|
||||
|
||||
if (
|
||||
absVal(shotPosition.x - player.mCamera.position.x) > UNITS_PER_SQUARE * 5 ||
|
||||
absVal(shotPosition.y - player.mCamera.position.y) > UNITS_PER_SQUARE * 5 ||
|
||||
(textureAt(shotPosition.x / UNITS_PER_SQUARE,shotPosition.y / UNITS_PER_SQUARE) != 0)
|
||||
)
|
||||
shotFired = false;
|
||||
}
|
||||
else if (pokitto.cBtn())
|
||||
{
|
||||
shotPosition = player.mCamera.position;
|
||||
shotDirection = d;
|
||||
shotFired = true;
|
||||
}
|
||||
|
||||
Vector2D moveOffset;
|
||||
|
||||
moveOffset.x = 0;
|
||||
|
|
Loading…
Reference in a new issue