Opening a chest

Hi,

I cant figure out how to make the controller to open and close a chest?
for a 2d side scroller
Thanks

What have you tried so far?

Does it (only) work when you’re within a certain range? Do you have to be facing it? Does it require any special item or variable to open?

:slight_smile:

yea when your over top of it and click say A and it opens and gives you the item

I’m looking for a prefab script so I can learn the code

You want a premade script?

Anyhow, let’s try to talk it through… How do you check if you’re “on top of it” ?
How do you determine if ‘A’ was clicked/typed?

:slight_smile:

Those 2 things, and you’ve got 2/3 done. Then you just get the item, – however that works in your game :wink:

If you’re not sure how to do those things, you might want to try some of the introduction stuff in the Learn section (accessible at the top of the forums*). :slight_smile: