Forum rules - please read before posting.

Blocking Hotspots?

Hi there!

I am clipping along... now on my fourth game and I am SO THANKFUL for your resources and for this forum!

In this newest game, I have a "floating" candy box that serves as the frame for a sudoku-style puzzle; the candies which get placed in the box move along on a conveyor belt of sorts beneath the box. Every candy on the belt has a hotspot, as do the empty spaces in the box where those candies are placed. The trouble I'm having is that players can actually grab the candies from the conveyor when hovering above the box itself.

Ideally, I would like for the candy-conveyor hotspots to be "blocked" by the candy box so that they're essentially disabled just for the duration of time that they're moving underneath the box. Is this possible? Maybe with a different use of the collider than I've been using?

I'd appreciate any help you can provide. :smile:

Ann

Unity 2022.3.0f1
AC 1.78.4

Comments

  • Hotspots can be blocked with a collider on the Default layer - a new empty GameObject and a Box Collider 2D attached should do it.

    You'll need to be careful of depth, however - even in 2D, the Z position is accounted for. You'll need to make sure that - on the Z-axis - the conveyor belt is further from the camera than the "blocking" collider. If the candies in the box are also interactive, they'll need to be closer still to the camera.

  • Ah - thank you for this! So, sorry for the daft question, but what z position should the main camera be in?? By closer, do you mean relative distance from it, or do you mean a greater number (more than 0)??

  • The Z-position itself isn't so important - it's more to do with its position relative to the other objects.

    For 2D games, it's generally easiest to have your gameplay / sprites be at Z=0, with the camera pulled back to view it (e.g. Z = -10).

    In your case, you have two "layers" of gameplay. If the candy box has Z = 0, move the conveyer further along (e.g. Z = 5). Alternatively, the conveyer can remain at Z = 0, and pull the candy box back (e.g. Z = -5).

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.