#define SPEED 2
//place holder definitions
-#define MAPX 24
-#define MAPY 19\r
+#define MAPX 40
+#define MAPY 30\r
//#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
void main() {\r
bitmap_t bmp;\r
-// int tx, ty;\r
-// int x, y;\r
int q=0;\r
page_t screen;//,screen2;\r
map_t map;\r
// draw = &mv2;\r
draw = &mv;
+//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
mapGoTo(draw, 0, 0);\r
-\r
- //TODO: set player position data here according to the viewable map screen thingy\r
+
+ //TODO: put player in starting position of spot\r
//default player position on the viewable map
player.tx = draw->tx + 10;
player.ty = draw->ty + 8;
modexShowPage(draw->page);\r
while(!keyp(1))
{\r
- //TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square\r
+ //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square\r
//to stop scrolling and have the player position data move to the edge of the screen with respect to the direction\r
//when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map
if(keyp(77))
{
- if(draw->tx >= 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10)
+ if(draw->tx >= 0 && draw->tx+20 < MAPX && player.tx == draw->tx + 10)
{\r
for(q=0; q<(TILEWH/SPEED); q++)
{\r
// mapScrollRight(draw, 1);\r
// SWAP(draw, show);\r
}
+ player.tx++;
}
- else if(player.tx < draw->tx+20 && player.tx >= draw->tx + 10)// && player.tx <= draw->tx+10)
+ else if(player.tx < MAPX)
{
for(q=0; q<(TILEWH/SPEED); q++)
{
}\r
\r
if(keyp(75)){
- if(draw->tx >= 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10)
+ if(draw->tx > 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10)
{\r
for(q=0; q<(TILEWH/SPEED); q++)
{\r
modexShowPage(draw->page);\r
// mapScrollLeft(show, 1);\r
// SWAP(draw, show);\r
- }\r
+ }
+ player.tx--;\r
}
- else if(player.tx > 0 && player.tx <= draw->tx + 10)// && player.tx >= draw->tx+10)
+ else if(player.tx > 0)
{
for(q=0; q<(TILEWH/SPEED); q++)
{
\r
if(keyp(80))
{
- if(draw->ty >= 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8)
+ if(draw->ty >= 0 && draw->ty+15 < MAPY && player.ty == draw->ty + 8)
{\r
for(q=0; q<(TILEWH/SPEED); q++)
{\r
// mapScrollDown(show, 1);\r
// SWAP(draw, show);\r
}
+ player.ty++;
}
- else if(player.ty < draw->ty+15 && player.ty >= draw->ty + 8)// && player.ty <= draw->ty+8)
+ else if(player.ty < MAPY)
{
for(q=0; q<(TILEWH/SPEED); q++)
{
\r
if(keyp(72))
{
- if(draw->ty >= 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8)
+ if(draw->ty > 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8)
{\r
for(q=0; q<(TILEWH/SPEED); q++)
{\r
// mapScrollUp(show, 1);\r
// SWAP(draw, show);\r
}
+ player.ty--;
}
- else if(player.ty > 0 && player.ty <= draw->ty + 8)// && player.ty >= draw->ty+8)
+ else if(player.ty > 0)// && player.ty <= draw->ty + 8)// && player.ty >= draw->ty+8)
{
for(q=0; q<(TILEWH/SPEED); q++)
{