Forum rules - please read before posting.

2D Opening and Closing Doors

Hello.

I've only just bought AC and have (after a few hours of rewinding and forwarding) completed the brilliant 2D primer tutorial so please forgive me if these 2 questions seem a bit obvious.

Firstly, I would like to make a sprite disappear and re-appear with subsequent clicks. I can make a sprite 'vanish' by using the teleport function but just cant seem to figure out how I bring it back with the next click. I'm not even sure if teleport is the right way to do this.

Secondly, I would like to know the simplest way (if there is one) to use a key from the inventory on a door to make it open.

Thanks in advance.

Comments

  • Welcome to the community, @CABJ.

    I would like to make a sprite disappear and re-appear with subsequent clicks. I can make a sprite 'vanish' by using the teleport function but just cant seem to figure out how I bring it back with the next click.

    If you're just looking to affect the sprite's visibility, you can use the Object: Visibility Action to show/hide it.

    You can precede these two Actions with an Object: Check visibility Action to work out if it's currently visible, and then hide it if so / show it if not. Otherwise, you'd have to look into using a Variable to keep track of its "is visible" state.

    I would like to know the simplest way (if there is one) to use a key from the inventory on a door to make it open.

    Inventory interactions can be defined at the bottom of a Hotspot's Inspector - which each interaction having a field for the Inventory item it should respond to.

    To have a door open, you'd probably want to run an animation of some kind using the Object: Animate Action, as well as update a Component variable attached to it that is used to keep track of it's "locked" state.

    This kind of game logic is covered in this section of AC's Interactivity tutorial series. A working example of a "key and lock" can also be found within the "Puzzle template: simple examples" package over on the Downloads page.

  • Hi,

    Many thanks for your solution!!

    It seems to work a treat. This what I did following your instruction. Hopefully it doesn't need anything else. It does function in exactly the way I wanted so thanks again.

    I'll get onto the door issue after following the links you kindly supplied.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.