Forum rules - please read before posting.

FPS 2D Interactive Object In Scene - Best Practice

Hello all, this is a somewhat open-ended question, and wanted to ask for tips or best approaches.

In my 2D scene, I have a chest buried behind some logs. This animation was created as a set of sprites of approx 60 frames long. I have created the animation in Unity ( copied and pasted in the PNG sequence ). Now comes the logic part and the best approach.

In the scene, I want to make it so that when the player 'interacts' with logs the animation triggers, and the chest is left revealed at the end. I would probably delete the log animation and 'teleport' the small check you can pick up at the end if that makes sense?

What is the best approach to come about this as an interactive object and animation in the scene? Is it more straightforward than I realise?

In a nutshell:-

  • There is (idle) object ( log pile) in the scene
  • Player uses or interacts with it ( animation triggers sending logs every where )
  • After the logs finish scattering, the pick up "teleports" into vie, on top of a marker

Will this method work? And what is the best way of doing so? ( NPC ), SImple game object, something else etc.

Kind Regards,

J

Comments

  • From your description, I don't see a specific need to teleport anything - the chest can begin the same in the position the Player finds it in. Just lower its "Sort Order" so that it is drawn underneath the logs when the two sprites overlap.

    What you will want to do is disable the chest's Hotspot until it is reveals by moving the logs. You can do this by attaching a Remember Hotspot component to it, and setting its State on start field to Off.

    The ActionList run when interacting with the logs would then essentially consist of:

    • Object: Animate - to animate the logs
    • Hotspot: Enable or disable - to enable the chest's Hotspot

    To make the chest a Hotspot, it needn't be an NPC - just attach AC's Hotspot component to it, as well as a 2D Collider that describes its clickable shape.

  • __" Just lower its "Sort Order" so that it is drawn underneath the logs when the two sprites overlap." __

    I _really _this approach. I didn't realise in AC that you could do this ( shift layers )? And when you say it out loud, brilliantly simple. Oh sorry, actually you don't even need to swap the layers about. As the logs are above, that will mask the pickup item until the animation has played and the hotspot to fire the animation is moved. Log scatter.

    Once that has played, as you mentioned, the hotspot can then activate. Workable in a couple of ways.

    Makes sense.

    And thank you again Chris! Brilliant stuff and answers as always.

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.