potion sprite doesn't appear
im doing a paralaxing game where obstacles appear and you jump over them and the obstacle code works but the potions you should be able to pick up doesnt appear. help would really be appreciated
when the game is reset a potion list is made:
potion = [550]
in the update function I wrote this for checking if the potion is collected or avoided:
for i=0 to potion.length-1 if potion[i]<position-120 then potion[i] = player_x+280+random.next()200 passed[i] = 0 collected[i] = 0 end if abs(player_x-potion[i])<10 then if hero_y<10 then collected[i] = 1 speed = speed0.8 potion[i] = player_x+280+random.next()*200 elsif not passed[i] then passed[i] = 1 end end end
and in the draw function I wrote this for only making it appear if its collected:
screen.setDrawScale(1,1) for i=0 to potion.length-1 if collected[i] == 0 then screen.drawSprite(sprites["potion"].setFrame(0),potion[i]-position-80,-50,20) else screen.drawSprite(sprites["potion"].setFrame(1),potion[i]-position-80,-50,20) end end
I made two frames in the sprite "potion" one of the potion and one for when its collected because I cant find a show and hide feature