0,]']±>Sï}WÿÍu§ðp8·d%qy)6oÊʉÞÞ¥]4@ôôô”°ÂVl†3100 then p.hp=100 end if openinv then realinvindex=invindex[1]+(invindex[2]-1)*5 cls() print(inv[realinvindex][3],70,10,2,0,1) rect(8,8,60,55,0) rectb(8,8,60,55,2) print("Inventory",10,10,2,0,1) rectb(11,17,10,10,15) rectb(22,17,10,10,15) rectb(33,17,10,10,15) rectb(44,17,10,10,15) rectb(55,17,10,10,15) rectb(11,28,10,10,15) rectb(22,28,10,10,15) rectb(33,28,10,10,15) rectb(44,28,10,10,15) rectb(55,28,10,10,15) rectb(11,39,10,10,15) rectb(22,39,10,10,15) rectb(33,39,10,10,15) rectb(44,39,10,10,15) rectb(55,39,10,10,15) rectb(11,50,10,10,15) rectb(22,50,10,10,15) rectb(33,50,10,10,15) rectb(44,50,10,10,15) rectb(55,50,10,10,15) rectb(11*invindex[1],6+invindex[2]*11,10,10,2) --draws inv sprites ix=1;iy=1;i=1 for s in pairs(inv) do spr(inv[i][1],(11*ix)+1,(11*iy)+7,0,1,0,0,1,1) ix=ix+1 i=i+1 if ix==6 then ix=1;iy=iy+1 end end if useprompt then rect(100,50,35,36,0) rectb(100,50,35,36,2) print("Use",105,54,2) print("Drop",105,65,2) print("Back",105,76,2) if useindex==0 then rectb(103,52,30,10,2) rectb(103,63,30,10,15) rectb(103,74,30,10,15) elseif useindex==1 then rectb(103,52,30,10,15) rectb(103,63,30,10,2) rectb(103,74,30,10,15) elseif useindex==2 then rectb(103,52,30,10,15) rectb(103,63,30,10,15) rectb(103,74,30,10,2) end end if equipprompt then rect(100,50,35,36,0) rectb(100,50,35,36,2) print("Equip",105,54,2) print("Drop",105,65,2) print("Back",105,76,2) if equipindex==0 then rectb(103,52,30,10,2) rectb(103,63,30,10,15) rectb(103,74,30,10,15) elseif equipindex==1 then rectb(103,52,30,10,15) rectb(103,63,30,10,2) rectb(103,74,30,10,15) elseif equipindex==2 then rectb(103,52,30,10,15) rectb(103,63,30,10,15) rectb(103,74,30,10,2) end end if equipprompt then if btnp(0) and equipindex==0 then equipindex=2 elseif btnp(0) and equipindex~=0 then equipindex=equipindex-1 elseif btnp(1) and equipindex==2 then equipindex=0 elseif btnp(1) and equipindex~=2 then equipindex=equipindex+1 elseif btnp(4) and equipindex==0 then equiped=realinvindex;equipprompt=false elseif btnp(4) and equipindex==1 then inv[realinvindex]={0,0,"",""};equipprompt=false elseif btnp(4) and equipindex==2 then equipprompt=false elseif btnp(5) then equipprompt=false end elseif useprompt then if btnp(0) and useindex==0 then useindex=2 elseif btnp(0) and useindex~=0 then useindex=useindex-1 elseif btnp(1) and useindex==2 then useindex=0 elseif btnp(1) and useindex~=2 then useindex=useindex+1 elseif btnp(4) and useindex==0 then p.hp=p.hp+inv[realinvindex][2]; inv[realinvindex]={0,0,"",""}; useprompt=false elseif btnp(4) and useindex==1 then inv[realinvindex]={0,0,"",""}; useprompt=false elseif btnp(4) and useindex==2 then useprompt=false elseif btnp(5) then useprompt=false end else if btnp(0) and invindex[2]>1 then invindex[2]=invindex[2]-1 elseif btnp(0) then invindex[2]=4 end if btnp(1) and invindex[2]<4 then invindex[2]=invindex[2]+1 elseif btnp(1) then invindex[2]=1 end if btnp(2) and invindex[1]>1 then invindex[1]=invindex[1]-1 elseif btnp(2) then invindex[1]=5 end if btnp(3) and invindex[1]<5 then invindex[1]=invindex[1]+1 elseif btnp(3) then invindex[1]=1 end if btnp(4) and inv[realinvindex][4]=="Weapon" then equipprompt=true end if btnp(4) and inv[realinvindex][4]=="Food" then useprompt=true end if btnp(5) then openinv=false end end return end --pickup prompt if pickupprompt then rect(20,20,100,50,0) rectb(20,20,100,50,2) rectb(22,22,96,46,2) print("Pickup",24,24,2,0,1) print(weaponnames[pickupweaponindex],62,24,2,0,1) print("Yes",28,56,2,0,1) print("No",100,56,2,0,1) if btnp(2) then pickupindex=0 end if btnp(3) then pickupindex=1 end --find and empty slot in the inventory to place it in. if btnp(4) and pickupindex==0 then pickedup=false for i in pairs(inv) do if inv[i][1]==0 and pickedup==false then inv[i][1]=pickupweaponindex+239 inv[i][2]=weapondamage[pickupweaponindex] inv[i][3]=weaponnames[pickupweaponindex] inv[i][4]="Weapon" pickupprompt=false pickedup=true end --add inv full message end end if btnp(4) and pickupindex==1 then pickupprompt=false end if pickupindex==0 then rectb(26,54,22,9,2) end if pickupindex==1 then rectb(98,54,15,9,2) end return end if incombat then cls(0) --player hud map(0,34,30,17,0,0) print("[Combat]",73,4,2,0,2) print("Player",5,22,2,2) print("Level:",5,34,2,2) print("Health:",5,42,2,2) print(tostring(p.hp),45,42,2,2) rectb(5,100,54,14,15) print("Attack",14,104,2,2) rectb(61,100,54,14,15) print("Inv",80,104,2,2) rectb(5,116,54,14,15) print("Run",24,120,2,2) rectb(61,116,54,14,15) --enemy info print("Zombie",125,22,2,2) print("Health:",125,44,2,2) print(tostring(z.hp),165,44,2,2) --highligh choice if combatindex==0 then rectb(5,100,54,14,2) elseif combatindex==1 then rectb(61,100,54,14,2) elseif combatindex==2 then rectb(5,116,54,14,2) elseif combatindex==3 then rectb(61,116,54,14,2) end --Moves the curser to the options if btnp(0) and combatindex < 2 then combatindex = combatindex + 2 elseif btnp(0) and combatindex >= 2 then combatindex = combatindex - 2 elseif btnp(1) and combatindex < 2 then combatindex = combatindex + 2 elseif btnp(1) and combatindex >= 2 then combatindex = combatindex - 2 elseif btnp(2) and combatindex%2==0 then combatindex = combatindex + 1 elseif btnp(2) and combatindex%2==1 then combatindex = combatindex - 1 elseif btnp(3) and combatindex%2==0 then combatindex = combatindex + 1 elseif btnp(3) and combatindex%2==1 then combatindex = combatindex - 1 end --handles the choice and end of turn if btnp(4) and combatindex==0 then attack(); turnEnd() end if z.hp <= 0 then incombat=false; z.hp = 100 end return end --Main Menu if newgame then cls() map(0,17,30,17,0,0) print("Zombie Mayham",5,4,2,0,3) if t%60 < 30 then print("press A button to start",52,120,12,0,1) else print("press A button to start",52,120,11,0,1) end if btnp(4) then newgame=false end return end --player input if btnp(0) then player.moveUp(p) end if btnp(1) then player.moveDown(p) end if btnp(2) then player.moveLeft(p) end if btnp(3) then player.moveRight(p) end if btnp(7) then invindex[1]=1 invindex[2]=1 openinv=true end --check if zombie died --need to add differnt kinds of enemys if z.hp<=0 then z.x=math.random(1,19)*8 z.y=math.random(1,15)*8 z.hp=100 score=score+1 end --check if player died if p.hp<0 then cls() print("GAME OVER!",30,5,2,10,3) print("SCORE:",95,100,12,3) print(tostring(score),130,100,12,3) return end cls() map(0,0,30,17,0,0) -- HUD rect(170,0,72,136,0) rectb(168,0,72,136,2) rectb(170,2,68,132,2) print("HP:",172,4,2,4) print(tostring(p.hp),188,4,2,4) print("Item:",171,12,2,4) print(inv[equiped][3],200,12,2,4) --spr(33+z.hp//13,z.x,z.y-8,0,1,0,0,1,1) spr(1,p.x,p.y,0,1,0,0,1,1) --spr(2,z.x,z.y,0,1,0,0,1,1) end function turnEnd() p.hp = p.hp - math.random(3,8) end function genWeapon() if math.random(1,10)==10 then mset(math.random(1,19),math.random(1,15),math.random(1,6)+weaponindexoffset) elseif math.random(1,10)==10 then mset(math.random(1,19),math.random(1,15),foodindexoffset+math.random(1,4)) end end function attack() z.hp = z.hp - inv[equiped][2] end