Simple Inventory System

Complete noob alert!

I would like to have a sprite in the corner of the room change from a blank frame to a picture of a key when a key is collected in the game area of the room. As a form of simple inventory on screen.

My script for that sprite is:

on loop do
if keys==1 then
frame 1
else
frame 0
end
end

However, the sprite does not change when the key item is collected. Any ideas?

Thanks in advance.

1 Like

loop only works with the game's script and even if that works, I wouldn't recommend having a loop that checks every frame if a key has been collected. Instead, use tell to set the frame after collecting the key.

keys = 1
tell x,y to //change this to the sprite's location
frame 1
end 

Hopefully, this should solve your issue

1 Like

Many thanks. This worked :+1:

2 Likes