-- The Legend of Zelda -- Sprite bomb -- By Saffith local function on_click(x, y) if(memory.readbyte(0x00BD)~=0) then -- Bomb slot #2 is used, so just quit if it's in use return end local which=-1 local sprite_type=0 local sprite_x=0 local sprite_y=0 -- Which sprite was clicked? for i=0,10 do sprite_type=memory.readbyte(0x0350+i) sprite_x=memory.readbyte(0x0071+i) sprite_y=memory.readbyte(0x0085+i) if((sprite_type>104 or (sprite_type>0 and sprite_type<95)) and -- Exclude certain sprites... x>=sprite_x and x<=sprite_x+15 and y>=sprite_y and y<= sprite_y+15) then which=i break end end -- Didn't click on a valid sprite? if(which<0) then return end -- Clear the sprite memory.writebyte(0x0486+which, 0) memory.writebyte(0x0350+which, 0) -- Create the explosion memory.writebyte(0x00BD, 18) memory.writebyte(0x0081, sprite_x) memory.writebyte(0x0095, sprite_y) end local mouse={} local prev_mouse={} while(true) do mouse=input.get() -- Check for click, and make sure the game is unpaused and the subscreen isn't active if(memory.readbyte(0x00E0)==0 and memory.readbyte(0x00FC) and mouse.click==1 and prev_mouse.click==0) then on_click(mouse.xmouse, mouse.ymouse) end prev_mouse=mouse FCEU.frameadvance() end