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

the next character to the left of key 1 pressed three times causes what is inside this block to be treated as program code and the text is not modified.

You also close the block with 3 such characters.


I can't read the code you provided.

It's best to make the project public and provide a link to it.

Post a reply



Validate your e-mail address to participate in the community