+ if(npc0.ty > 1 && !(npc0.tx == TRIGGX && npc0.ty-1 == TRIGGY) && !(npc0.tx+1 == player.tx && npc0.ty == player.ty-1))\r
+ {\r
+ if(npc0.q<=(TILEWH/SPEED))\r
+ {\r
+ INC_PER_FRAME_NPC;\r
+ npc0.y-=SPEED;\r
+ //animatePlayer(bg, spri, mask, 0, 0, npc0.x, npc0.y, persist_aniframe, q, &npctmp);\r
+ modexShowPage(spri->page);\r
+ animatePlayer(bg, spri, npc0.d-1, 0, npc0.x, npc0.y, persist_aniframe, npc0.q, &npctmp);\r
+ npc0.q++;\r
+ } else { npc0.q = 1; npc0.d = 0; npc0.ty--; }\r
+ }\r
+ else\r
+ {\r
+ modexCopyPageRegion(spri->page, bg->page, npc0.x-4, npc0.y-TILEWH, npc0.x-4, npc0.y-TILEWH, 24, 32);\r
+ modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 0, 24, 32, &npctmp);\r
+ modexShowPage(spri->page);\r
+ npc0.d = 0;\r
+ }\r
+ npc0.triggerx = npc0.tx;\r
+ npc0.triggery = npc0.ty-1;\r
+ }\r
+\r
+ if((npc0.triggery == player.ty && npc0.triggerx == player.tx) || (npc0.ty == player.ty && npc0.tx == player.tx)){ player.hp--; }\r
+*/\r
+\r
+ //player movement\r
+ //TODO: make movement into a function!
+ if(!panswitch){\r
+ //right movement\r
+ if((keyp(77) && !keyp(75) && player.d == 0) || player.d == 2)\r
+ {\r
+ if(player.d == 0){ player.d = 2; }\r
+ if(bg->tx >= 0 && bg->tx+20 < map.width && player.tx == bg->tx + 10 &&
+ !(bg->map->data[(player.tx)+(map.width*(player.ty-1))] == 0))//!(player.tx+1 == TRIGGX && player.ty == TRIGGY)) //collision detection!\r