Forum rules - please read before posting.

how do i properly remove an object with a hotspot from a scene?

edited October 2014 in Technical Q&A
Hey

In the first scene of Bolt Riley (2D) I have some drumsticks you need to pick up.
I'm using the Choose hotspot then interaction. 
I want to remove the sprite and the hotspot once it's been picked up and save that state.

I've created a hotspot, then it has a child that has the sprite.
I have Remeber Hotspot on my hotspot (parent) object,  and remember visibility on the sprite (child) object.

if i only turn off both interactions i have on the hotspot (look and pick up)  i still see the hotspot when i hover my mouse on it.

If if also remove the object from the tree- it's state doesn't get saved. 
How do i remoev the hotspot so that it won't show up without removeing the object itself?

Oded

Comments

  • It seems handy to parent hotspots with their associated sprite but AC doesn't organise the objects that way. Chris will no doubt be able to better explain why/if this has a significant rationale but my understanding is this:

    Hotspots are organised to be in the "_Logic" Hierarchy group.
    Sprites should go into the "_SetGeometry" Hierarchy group.

    Your interaction should process the hiding of the sprite and the disabling of the hotspot as two separate ActionList functions like this:

    Sprite= Object:visibility (set to INVISIBLE)
    Hotspot = Object: Send message (set to TURN OFF)

    Both the sprite and the hotspot need their own "remember script":
    Sprite  = REMEMBER VISIBILITY
    Hotspot = REMEMBER HOTSPOT

    Hope this helps.
  • @Xidore: Thanks again for helping out with your explanations, it's appreciated!

    @SoundGuy: This is correct - you should generally keep Hotspots and their associated sprites separate (mainly to ensure no problems with prefab links), but adding the two Remember scripts and using the two Actions mentioned above is the main thing to do here.
  • Ok. cool. now it's working and saving.

    Also I've noticed something new in another case. 
    How do i save the animation state of a sprite object?  
    I have one case where there's a transform animation for one sprite, and for another sprite - i change the sprite image, then i use animate in the interaction.

    what do i add to the sprite object to save that?

  • It's not possible to save the animation state in that way, as there's too much complexity and room for error involved.  Instead, you need to use logic Actions in your "Cutscene on start" / "On Load" to play the correct animation.

    Let's say you have an "Alarm" sprite that flashes when the player enters a restricted area.  When they enter the area, set a Variable (can be Global or Local) called "Alarm is on" to TRUE.  Then, in your OnStart / OnLoad Cutscenes, use the Variable: Check Action to determine it's value.  If it's TRUE, play the animation - if FALSE, don't.

    For a better example, the 3D Demo game does a similar trick for the barrel, that gets tipped over mid-game.
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.