diff --git a/demo1.cpp b/demo1.cpp index 96be344..9016b01 100644 --- a/demo1.cpp +++ b/demo1.cpp @@ -24,7 +24,7 @@ Player player; -#define SPRITES 13 +#define SPRITES 17 #define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE Sprite sprites[SPRITES]; @@ -430,7 +430,7 @@ const unsigned char texture4[] = ,0x12,0x00 }; -const unsigned char sprite1[] = +const unsigned char spriteStatue[] = { 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 @@ -508,7 +508,7 @@ const unsigned char sprite1[] = ,0x07,0x07 }; -const unsigned char sprite2[] = +const unsigned char spriteNPC[] = { 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 @@ -586,7 +586,7 @@ const unsigned char sprite2[] = ,0x07,0x07 }; -const unsigned char sprite3[] = +const unsigned char spriteTree[] = { 32, 32 // width, height ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x7b,0x7b,0x58,0x07,0x07 ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 @@ -664,7 +664,7 @@ const unsigned char sprite3[] = ,0x07,0x07 }; -const unsigned char sprite4[] = +const unsigned char spriteGrass[] = { 24, 24 // width, height ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 ,0x07,0x58,0x0a,0x0a,0x0a,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 @@ -710,7 +710,7 @@ const unsigned char sprite4[] = ,0x07,0x07 }; -const unsigned char sprite5[] = +const unsigned char spriteBarrel[] = { 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 @@ -788,6 +788,162 @@ const unsigned char sprite5[] = ,0x07,0x07 }; +const unsigned char spriteTorch1[] = +{ 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,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,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,0x12,0x12,0x12,0x12,0x07,0x07,0x07,0x07,0x09 + ,0x09,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 + ,0x07,0x07,0x07,0x0c,0x07,0x07,0x15,0x15,0x1e,0x15,0x0c,0x15,0x12,0x12 + ,0x12,0x12,0x07,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07 + ,0x07,0x07,0x07,0x07,0x07,0x0c,0x07,0x07,0x0c,0x15,0x0c,0x15,0x1e,0x15 + ,0x2f,0x12,0x12,0x64,0x64,0x12,0x12,0x09,0x09,0x09,0x09,0x09,0x00,0x00 + ,0x00,0x00,0x00,0x07,0x07,0x0c,0x1e,0x07,0x07,0x07,0x0c,0x15,0x2f,0x2f + ,0x1e,0x1e,0x15,0x2f,0x7f,0x7f,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x12 + ,0x09,0x12,0x09,0x09,0x00,0x00,0x00,0x07,0x07,0x07,0x1e,0x15,0x1e,0x1e + ,0x0c,0x1e,0x1e,0x15,0x15,0x2f,0x2f,0x7f,0x7f,0x12,0x12,0x64,0x64,0x64 + ,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x00,0x00,0x00,0x00,0x07,0x07 + ,0x07,0x1e,0x0c,0x0c,0x1e,0x15,0x15,0x0c,0x1e,0x15,0x1e,0x2f,0x7f,0x7f + ,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x12,0x09,0x12,0x09,0x09,0x00,0x00 + ,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0c,0x15,0x1e + ,0x1e,0x1e,0x2f,0x12,0x12,0x64,0x64,0x12,0x12,0x09,0x09,0x09,0x09,0x09 + ,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 + ,0x07,0x07,0x0c,0x15,0x1e,0x15,0x0c,0x15,0x12,0x12,0x12,0x12,0x07,0x09 + ,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07 + ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x12,0x12,0x12,0x12,0x07 + ,0x07,0x07,0x07,0x09,0x09,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,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,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 +}; + +const unsigned char spriteTorch2[] = +{ 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,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,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,0x12,0x12,0x12,0x12,0x07,0x07,0x07,0x07,0x09 + ,0x09,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 + ,0x07,0x0c,0x0c,0x0c,0x07,0x07,0x07,0x15,0x1e,0x15,0x0c,0x15,0x12,0x12 + ,0x12,0x12,0x07,0x09,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07 + ,0x07,0x07,0x07,0x07,0x0c,0x15,0x1e,0x15,0x0c,0x15,0x0c,0x15,0x15,0x1e + ,0x15,0x12,0x12,0x64,0x64,0x12,0x12,0x09,0x09,0x09,0x09,0x09,0x00,0x00 + ,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x0c,0x15,0x1e,0x2f,0x1e,0x15,0x1e + ,0x1e,0x2f,0x2f,0x2f,0x2f,0x7f,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x12 + ,0x09,0x12,0x09,0x09,0x00,0x00,0x00,0x07,0x07,0x0c,0x07,0x1e,0x0c,0x0c + ,0x15,0x2f,0x1e,0x1e,0x1e,0x1e,0x2f,0x2f,0x7f,0x12,0x12,0x64,0x64,0x64 + ,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x00,0x00,0x00,0x00,0x07,0x07 + ,0x0c,0x0c,0x07,0x0c,0x0c,0x15,0x0c,0x15,0x0c,0x1e,0x2f,0x1e,0x2f,0x7f + ,0x12,0x12,0x12,0x12,0x12,0x12,0x09,0x12,0x09,0x12,0x09,0x09,0x00,0x00 + ,0x00,0x00,0x07,0x07,0x07,0x0c,0x07,0x07,0x07,0x0c,0x15,0x0c,0x15,0x15 + ,0x15,0x1e,0x15,0x12,0x12,0x64,0x64,0x12,0x12,0x09,0x09,0x09,0x09,0x09 + ,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x0c,0x07,0x07,0x07,0x0c,0x07 + ,0x07,0x0c,0x0c,0x15,0x1e,0x15,0x0c,0x15,0x12,0x12,0x12,0x12,0x07,0x09 + ,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07 + ,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x12,0x12,0x12,0x12,0x07 + ,0x07,0x07,0x07,0x09,0x09,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,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,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 +}; + const unsigned char *textures[] = {texture1, texture2, texture3, texture4}; Unit textureAt(int16_t x, int16_t y) @@ -884,9 +1040,17 @@ void draw() PixelInfo pos = mapToScreen(sprites[i].mPosition,sprites[i].mHeight,player.mCamera); if (pos.depth > 0) - drawSpriteSquare(sprites[i].mImage,pos.position.x * SUBSAMPLE, + { + const unsigned char *image = sprites[i].mImage; + + if (image == spriteTorch1 && // animate torch + (pokitto.frameCount >> 2) % 2 == 0) + image = spriteTorch2; + + drawSpriteSquare(image,pos.position.x * SUBSAMPLE, pos.position.y, pos.depth, perspectiveScale(sprites[i].mPixelSize,pos.depth)); + } /* trick: sort the sprites by distance with bubble sort as we draw - the order will be correct in a few frames */ @@ -923,29 +1087,28 @@ int main() player.setPositionSquare(6,4); - // statues - sprites[0] = Sprite(sprite1,10,5,1,100); - sprites[1] = Sprite(sprite1,14,5,1,100); - - // NPC - sprites[2] = Sprite(sprite2,15,19,1,200); - - // trees - sprites[3] = Sprite(sprite3,8,2,1,300); + sprites[0] = Sprite(spriteStatue,10,5,1,100); + sprites[1] = Sprite(spriteStatue,14,5,1,100); + sprites[2] = Sprite(spriteNPC,15,19,1,200); + sprites[3] = Sprite(spriteTree,8,2,1,300); sprites[3].mPosition.y -= UNITS_PER_SQUARE / 2; - sprites[4] = Sprite(sprite3,20,5,1,300); - sprites[5] = Sprite(sprite3,26,18,1,300); - sprites[6] = Sprite(sprite3,16,12,1,300); - - // grass - sprites[7] = Sprite(sprite4,27,16,0,100); - sprites[8] = Sprite(sprite4,6,6,0,150); - sprites[9] = Sprite(sprite4,8,5,0,120); - sprites[10] = Sprite(sprite4,17,6,0,150); - - // barrels - sprites[11] = Sprite(sprite5,12,16,0,120); - sprites[12] = Sprite(sprite5,27,5,0,120); + sprites[4] = Sprite(spriteTree,20,5,1,300); + sprites[5] = Sprite(spriteTree,26,18,1,300); + sprites[6] = Sprite(spriteTree,16,12,1,300); + sprites[7] = Sprite(spriteGrass,27,16,0,100); + sprites[8] = Sprite(spriteGrass,6,6,0,150); + sprites[9] = Sprite(spriteGrass,8,5,0,120); + sprites[10] = Sprite(spriteGrass,17,6,0,150); + sprites[11] = Sprite(spriteBarrel,12,16,0,120); + sprites[12] = Sprite(spriteBarrel,27,5,0,120); + sprites[13] = Sprite(spriteTorch1,11,9,2,120); + sprites[13].mPosition.y += UNITS_PER_SQUARE / 3; + sprites[14] = Sprite(spriteTorch1,13,9,2,120); + sprites[14].mPosition.y += UNITS_PER_SQUARE / 3; + sprites[15] = Sprite(spriteTorch1,14,19,2,120); + sprites[15].mPosition.y += UNITS_PER_SQUARE / 3; + sprites[16] = Sprite(spriteTorch1,1,19,3,120); + sprites[16].mPosition.y += UNITS_PER_SQUARE / 3; uint32_t previousTime = 0; uint32_t dt;