Interactive HUD

PixelotlPixelotl Member Posts: 7
edited November -1 in Working with GS (Mac)
Hi,

I'm working on my first game with GameSalad.
My gameplay is along the lines of a scrolling platformer. I need to spawn actors in the HUD that can be moved by touch to interact with scrolling elements on the game layer.

At the moment the HUD and game layers can't interact, so I am really having trouble getting this to work.

If I spawn the actor on the game layer, it just goes off screen. Is there a way to lock it's X position relative to the camera?

tl;dr - Is there a way to keep stuff static on the screen without putting it on an unscrollable layer?

Comments

  • AjBlueAjBlue Member Posts: 215
    constrain your objects x and y to the cameras x and y
  • PixelotlPixelotl Member Posts: 7
    Yeah, I thought as much, but where do I find the cameras X and Y? I can't seem to find it in the attributes drop down.

    Ohhh, I see. I need to apply it to the actor in the scene, not the prototype.

    Thanks.
  • PixelotlPixelotl Member Posts: 7
    OK, so on the same topic, I need some help.

    I have my HUD, and on the hud, after X rule has been fulfilled, I want X actor to spawn on that area of the HUD when I click on it with my mouse. Once selected, I want it to follow my mouse to interact with actors in the scene.

    I can't get it to work... I've had it kind of work, but then I try to make it work properly and it doesn't work at all :/

    Any help would be greatly appreciated.
  • PixelotlPixelotl Member Posts: 7
    I hate to bump, but I can't edit my earlier posts...

    I managed to fix my problem with the HUD/following mouse, but now I have another issue.

    The situation: When attribute x = 1, you can click on the hud to spawn the item and drag it to the game space. This resets attribute x back to 0.
    When attribute x = 1 again, and I click to spawn and drag the actor again, it is instantly destroyed...

    I don't understand how it could do this, as everything should reset back to how it was at the start of the scene, and it works perfectly the first time...
  • simo103simo103 Member, PRO Posts: 1,331
    sounds to me like whatever triggers the first actor to be destroyed is still in that state when the second one is created thus it immediately destroys.

    Do you have a rule that destroys the actor? If so you will need to create a self. attribute in your spawned actor and when that attribute has a certain value then destroy that actor.
  • PixelotlPixelotl Member Posts: 7
    The second one only destroys after I click on it, not immediately.
    I have an attribute in the actor that is set to false when the actor collides with the target, or press is released.
    If that attribute is false, the actor is destroyed.

    Could it be the rule? If I set it to 'when mouse button up' and click on it, it is destroyed straight away (even though I hold the button down), but if I set it to 'when touch released' it works perfectly (the first time).
  • PixelotlPixelotl Member Posts: 7
    I don't want to make a new thread, so I'll revive this one.

    Still have the same issue outlined above, driving me crazy.

    What I want to know now, and it will probably be easy: I have things you can collect on the screen, and when you collect 4 it gives you the ability to use 1 item in the HUD, so if you have 8 you will have two items, and so on.

    What is the logic to make it so I can only take one item at a time from the HUD? Right now if there are more than one they just get destroyed.
    I tried making an attribute that tracked if it had been touched and set touch to true, touch needed to be false to take an item. However, I don't know how I should reset it back to false after I take it. I tried a timer that sets it to false after .5 seconds. Didn't work.

    I'm going crazy here... Wanted to finish the gameplay mechanics two days ago...
Sign In or Register to comment.