Collisions and Scrollable Layers

twinpixtwinpix Member Posts: 49
edited November -1 in Working with GS (Mac)
Can collisions be detected properly on actors that are on scrollable and non-scrollable layers?

I'm moving my the camera to make my scene pan left and right. I've created a camera offset actor so I can drag and drop actors in the scene, which works properly.

However, when I an actor on my scrollable layer and drop it onto an actor on my HUD layer (which is NOT scrollable), Gamesalad doesn't detect the collision.

Please help!

Comments

  • floydianspiralfloydianspiral Member, PRO Posts: 308
    From my experience you should have any actors that you want to collide be on the same layer...I don't know if you can detect collisions across layers but why would you want to?
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    another suggestion would be to make an invisible actor on the same layer as the collidable object and constrain invis actor's position to the HUD actor on a different layer.
  • twinpixtwinpix Member Posts: 49
    Thanks so much, floydianspiral! Your suggestion worked.

    The reason I needed this solution is because I wanted to create a scrolling layer with draggable items on it. When the player wants to add an item to his inventory, he drags the item onto the drop-zone on the HUD layer (which doesn't scroll and is always in the upper right of the screen), and adds the item to his inventory.

    Here's how I did it:

    I created an Invisible Actor on the same layer as my draggable objects. Then I made two Real game attributes (DropZoneX, DropZoneY) and constrained them to the X & Y positions of the HUD drop-zone + the Camera Offset attributes. Next I constrained the X & Y positions of my Invisible Actor to DropZoneX and DropZoneY.

    Now when I test the collision of the draggable items and the invisible item, it works flawlessly.
  • CaptFinnCaptFinn Member Posts: 1,828
    Twinpix. Id love to see a temp for that.
  • twinpixtwinpix Member Posts: 49
    Okay, I've posted a template for the draggable items onto HUD Drop Zone here:

    http://gamesalad.com/game/18930
Sign In or Register to comment.