Forum rules - please read before posting.

Creating an object that changes when you click on it - 2d

Hi
I couldn't find a solution, but it's a rather simple problem - I'm making a 2d game.
I want to create an object that changes when you use it, before you can pick it up.
the first use interaction should change it's sprite, and the other use interaction would pick it up.
(I don't want that the user would be able to pick it up before the second use interaction)
What is the way to implement it?
Thank you
Yoni

Comments

  • If you use Interaction = Context Sensitive one way might be to create an ActionList Use: in the Standard interactions (Inventory -> yourItem).

    Object -> Send message -> Custom -> yourMethod

      In yourMethod a simple check:

    if (myObject is not transformed) {
    transform my object
    }
    else
    {
    KickStarter.runtimeInventory.SelectItemByID (yourItemID);
    }

    But this is just an idea I would try, it may not work, I'm new to AC and often I discover that it would suffice a single function against my ten

  • Welcome to the community, @avuryoni.

    As @valter points out, the solution can vary a little depending on your chosen Interaction method, but you can control the enabled state of Hotspot interactions by using the Hotspot: Change interaction Action.

    If you create two Use interactions, the first to change the object (enabled by default), the second to pick it up (disabled by default), you can use two of these Actions in the first Use interaction to toggle the two interactions so that the second is active after the first is run.

    To change the object, you can either have two sprites in the scene and "swap" their visibility using the Object: Visibility Action, or create animations for the sprite so that it changes graphic when e.g. a boolean parameter changes in its Animator controller.  That's done on the Unity side of things, but you can then use AC's Object: Animate Action to change the boolean parameter's value as part of the Use interaction to play the animation when desired.
  • Thanks a lot!
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.