Update time, Zelda II flavored.
edit: updated code at bottom
Right now the problem I'm having is that it won't draw the key graphic at all, regardless of if I'm trying to drawImage or drawIcon. The image file is in the same folder as the script, so I'm probably missing something obvious that I forgot.
There should be two keys being drawn, and I can't see it if it is.
EDIT: I think I fixed it but I'm not sure why this fixes it - for whatever reason it just fails at drawing images when you use event.onframestart(), but not when you use the old while true do loop method.
Language: lua
-- "Zelda II: The Adventure of Link"
local bagCounter = 0
local currentMP = 0
local currentHP = 0
local maxMP = 0
local maxHP = 0
local hearts = 0
local jars = 0
local armor = 0
local intel = 0
local skill = 0
local xp = 0
local toLevel = 1
local percentToLevel = 1
local keys = 0
local selector = 0
local magic = {[0]="No Magic","Shield","Jump","Life","Fairy","Fire","Reflect","Spell","Thunder"}
function main()
bagCounter = memory.readbyte(0x05DF);
currentMP = memory.readbyte(0x0773);
currentHP = memory.readbyte(0x0774);
hearts = memory.readbyte(0x0784);
jars = memory.readbyte(0x0783);
armor = memory.readbyte(0x0779);
intel = memory.readbyte(0x0778);
skill = memory.readbyte(0x0777);
xp = (memory.readbyte(0x0775)*255)+memory.readbyte(0x0776);
toLevel = (memory.readbyte(0x0770)*255)+memory.readbyte(0x0771);
keys = memory.readbyte(0x0793);
selector = memory.readbyte(0x0749) + 1;
percentToLevel = xp / toLevel;
maxMP = (jars*32)-1;
maxHP = (hearts*32)-1;
gui.drawBox(0,0,255,41,"White","Black");
gui.drawText(0,8,armor.."|HP: "..currentHP.."/"..maxHP,"Red",11);
gui.drawText(0,18,intel.."|MP: "..currentMP.."/"..maxMP,"White",11);
gui.drawText(0,28,skill.."|"..bagCounter.." enemies since last drop","Yellow",11);
for i = 1, keys, 1 do
gui.drawImage("key.png",95+(i*8),8);
end
gui.drawText(95,18,"Spell: "..magic[selector],"White",11);
gui.drawRectangle(245,8,10,(32*percentToLevel),"Green","Green");
gui.drawBox(245,8,255,40,"White");
end
while true do
main()
emu.frameadvance()
end
editwo: For drawText, how do I fiddle with the font family - am I restricted to certain fonts or can I use any installed font?