Forum rules - please read before posting.

A simple thing like opening a cabinet

Hi everyone!
I've just purchased and installed Adventure Creator... and I'm going through the "creating a 2d game" and "creating a first person game" tutorials (I don't want to do a first person one, but that tutorial covers some topics I'm interested in).
There's one thing, though, I'm failing to grasp: how to do a simple thing like a cabinet that can be opened where you can find an item inside that can be added to your inventory.
Can someone give me some clues about that?
Thank you!

Comments

  • A simple implementation would be to have the doors on the cabinet as a separate sprite to the rest of your cabinet then on a hotspot click move the doors to reveal the inside of the cabinet.  
  • Nice! thank you, I'll try that out!
  • But isn't it necessary to provide another sprite for the inside of the cabinet's door? When you open a cabinet, the door is still visible, and you see the other side of the door.
  • edited October 2018
    Normally when you design the background artwork in a 2D game, it's a good idea to design it as though all the doors have been removed. Ie, a cupboard would actually look like the door is missing and you'll see the shelves inside. Then you'd place a sprite for the item in place over the background, then place the door sprite on top of the item. The interaction would be to animate the door opening, revealing the item you can pickup. I hope that helps?
  • Yes, but wouldn't that create a "hotspot" problem? I mean, to use the door I'd need to make two hotspots: one where the closed door is (that makes the door open by clicking on it) and another one where the open door is (that makes the door close when clicking on it). If not, I'd need to click on the inside of the cabinet to make the door open and close, right?
  • Looks like I managed to do it. Maybe I have over-complicated it, but that's how I did:
    two separate hotspots (one for the closed door, one for the open one);
    clicking on the closed one, does the following:
    - turns invisible the cabinet door;
    - turns off the closed door hotspot;
    - plays a sound;
    - turns visible the opened door sprite;
    - turns on the open door hotspot.

    the open door one does the opposite:
    - turn invisible the open door;
    - turns visible the closed one;
    - turns off the open door hotspot;
    - turns on the closed door hotspot.

    Can this be a source of problems, or is it ok?
    Also, I didn't set the open door hotspot as "off" at the beginning. How can I set an hotspot to start as "off" at the beginning of a scene?


  • In the game editor, go to the Scene tab and create a new OnLoad cutscene. In this cutscene, do all the initial scene setup like disabling hotspots and moving characters to position etc. I've not done anything in 2D, but the method you described is how I first did door openings. It then kind of evolved a little. I had the hotspot as a child of the door. On opening, the door animates 90° and the hotspot (being a child) animates with it. So it automatically moves out of the way. I have an Open action and a Close action on the hotspot. The close action is disabled by default. When I open the door, I change the action to disable the "open" and enable the "close" action. And that's it :) Not sure how that would translate into 2D though? Kev
  • Setting the default state of a Hotspot is just a case of attaching the Remember Hotspot component to it, and setting that component's Hotspot state on start? property to Off.

    Triggers can similarly be configured using their equivalent Remember Trigger component.

    "Remember" components are used to correctly set object states when saving and loading.  For more on this topic, see the Manual's "Saving scene objects" chapter.
  • How can I attach the "Remember hotspot" component to the hotspot? I've tried looking for it in the "Add component" menu, but I couldn't find it... sorry if I'm bothering you with this, but I'm totally new to AC!
  • If you click "add component", clear the search and type "remember". It should appear.
  • Worked perfectly! Thank you very much!!
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.