Log In  
Follow
bob_billbert

An internet homunculus who makes games sometimes.


I'm trying to make a Zelda style game, but i can't for the life of me figure out how to work the inventory.
What I'm trying to do is make a sort of Silent Hill thing where it shows the one you highlighted as being larger than the previous, and next item. I'm not doing anything complex, each item you can get corresponds to a sprite in the sprite sheet (probably 14 sprites in total, 33 to 47). I'm using a table called inv by the way, I don't know though.
Here's a gif and the code for the inventory. the gif is from earlier, right now I've just kind of left the code blank-ish for now.

--inventory--

function upd_inv()

 poke(0x5f30,1)

 if btn(➡️) and bhd==false then
  itmsel+=1
 elseif btn(⬅️) and bhd==false then
  itmsel-=1
 end

 --this just makes sure the buttons are pushed once
 if btn(➡️) or btn(⬅️) or btn(⬆️) or btn(⬇️) and bhd==false then
   bhd=true
  elseif bhd==true and not btn(➡️) or btn(⬅️) or btn(⬆️) or btn(⬇️) then
   bhd=false
  end

 if btn(6) and bh6==false then
   state="play"
   bh6=true
  elseif bh6==true and not btn(6) then
   bh6=false
  end

end

function drw_inv()

--slots, middle shows item hovering over, right shows next item, left shows previous item
 sspr(8+slm*8,16,8,8,46+camx,46+camy,32,32)
 sspr(8+slr*8,16,8,8,82+camx,54+camy,16,16)
 sspr(8+sll*8,16,8,8,26+camx,54+camy,16,16)

end

Sorry for any bad grammar or spelling, and/or if this is confusing. It's 3:54am as I'm writing this and I'm also new here.

7 comments