- //modexClearRegion(bg->page, player.x, player.y, 16, 16, 4); //currently the over scan color!
- /*#define INC_PER_FRAME_NPC if(npc0.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
-
- if(npc0.d == 0 && npc0.q == 1) npc0.d =rand()%8;
- if(npc0.d>4)
- npc0.d=0;
-
- //right movement
- if(npc0.d == 2)
- {
- if(npc0.tx < map.width && !(npc0.tx+1 == TRIGGX && npc0.ty == TRIGGY) && !(npc0.tx+1 == player.tx && npc0.ty == player.ty))
- {
- if(npc0.q<=(TILEWH/SPEED))
- {
- INC_PER_FRAME_NPC;
- npc0.x+=SPEED;
- //animatePlayer(bg, spri, mask, 1, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);
- animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);
- modexShowPage(spri->page);
- npc0.q++;
- } else { npc0.q = 1; npc0.d = 0; npc0.tx++; }
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 32, 24, 32, &npctmp);
- modexShowPage(spri->page);
- npc0.d = 0;
- }
- npc0.triggerx = npc0.tx+1;
- npc0.triggery = npc0.ty;
- }
-
- //left movement
- if(npc0.d == 4)
- {
- if(npc0.tx > 1 && !(npc0.tx-1 == TRIGGX && npc0.ty == TRIGGY) && !(npc0.tx-1 == player.tx && npc0.ty == player.ty))
- {
- if(npc0.q<=(TILEWH/SPEED))
- {
- INC_PER_FRAME_NPC;
- npc0.x-=SPEED;
- //animatePlayer(bg, spri, mask, 3, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);
- animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);
- modexShowPage(spri->page);
- npc0.q++;
- } else { npc0.q = 1; npc0.d = 0; npc0.tx--; }
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 96, 24, 32, &npctmp);
- modexShowPage(spri->page);
- npc0.d = 0;
- }
- npc0.triggerx = npc0.tx-1;
- npc0.triggery = npc0.ty;
- }
-
- //down movement
- if(npc0.d == 3)
- {
- if(npc0.ty < map.height && !(npc0.tx == TRIGGX && npc0.ty+1 == TRIGGY) && !(npc0.tx == player.tx && npc0.ty == player.ty+1))
- {
- if(npc0.q<=(TILEWH/SPEED))
- {
- INC_PER_FRAME_NPC;
- npc0.y+=SPEED;
- //animatePlayer(bg, spri, mask, 2, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);
- animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);
- modexShowPage(spri->page);
- npc0.q++;
- } else { npc0.q = 1; npc0.d = 0; npc0.ty++; }
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);
- modexShowPage(spri->page);
- npc0.d = 0;
- }
- npc0.triggerx = npc0.tx;
- npc0.triggery = npc0.ty+1;
- }
-
- //up movement
- if(npc0.d == 1)
- {
- if(npc0.ty > 1 && !(npc0.tx == TRIGGX && npc0.ty-1 == TRIGGY) && !(npc0.tx+1 == player.tx && npc0.ty == player.ty-1))
- {
- if(npc0.q<=(TILEWH/SPEED))
- {
- INC_PER_FRAME_NPC;
- npc0.y-=SPEED;
- //animatePlayer(bg, spri, mask, 0, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);
- modexShowPage(spri->page);
- animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);
- npc0.q++;
- } else { npc0.q = 1; npc0.d = 0; npc0.ty--; }
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 0, 24, 32, &npctmp);
- modexShowPage(spri->page);
- npc0.d = 0;
- }
- npc0.triggerx = npc0.tx;
- npc0.triggery = npc0.ty-1;
- }
-
- if((npc0.triggery == player.ty && npc0.triggerx == player.tx) || (npc0.ty == player.ty && npc0.tx == player.tx)){ player.hp--; }
-*/
-