Actor (Character) 'Moves to' Hud (how to stop?)

BRGKeenBRGKeen Member Posts: 40
edited November -1 in Working with GS (Mac)
I have a button that opens my character's inventory that I need to press. I have it working where I press the button and the inventory opens and I press it again to close the inventory.

What isn't working right is that my character (actor) moves to that button when I press it because the actor operates under the logic that when the screen (an actor called "movement mat" that is the size of the screen) is touched, game.move=1 and 'move to' the x/y of that touch. I have my actor (character) moving exactly how I want him to move, except that I do not want him moving to the location of that button when it is pressed.

I've tried creating attributes and making them true when pressed and having my actor only move when they are false, but he moves anyway. I've even tried having that button trigger move to false but the character moves anyway.

Anyone have ideas? I could move the "movement mat" but I would prefer my actor have movement around the entire scene, even behind the button.

Comments

  • RedlerTechRedlerTech Member Posts: 1,583
    create an attribute for when HUD is pressed. When the HUD is pressed change attribute to true, otherwise false.

    In your character do if touch is pressed (or whatever you have for movement) AND HUDispressed is true then do the movement. Get it?

    Matt :D
  • BRGKeenBRGKeen Member Posts: 40
    That was my first thought and I tried it, but it doesn't seem to work.

    Button
    Rule: actor receives touch is pressed
    Change attribute game.inventoryactive to 1

    Character
    Rule: attribute game.inventoryactive is false (before doing anything else)

    The character just ignores the rule and moves anyway. It's the same with the inventory when it's up. I'd like the character not to move at all when the inventory is open. However, I can open the inventory and when click in the inventory the actor just moves to where I click (within the inventory). I need him to hold perfectly still while that inventory is open.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    the rule you have in the "movement mat" actor when touch is pressed change move to 1

    have it when touch is pressed and mouse position y is > 50 (or the y of your hud buttons)

    that way it will give you a whole bar at the bottom of your screen to pur your hud buttons that wont effect the actor movement
  • BRGKeenBRGKeen Member Posts: 40
    John,

    Although not ideal since I would like my character to move in the Y < 50 area, that works.

    How would I stop the actor from moving if the inventory is open (thus taking up a portion of the screen) and I do not want the actor moving to the location of the touch within the inventory? The point of the inventory being to interact with items, not control the character moving behind it.

    Edit: Nevermind, I solved it I think!

    I used a combination of the Y < 50 and NextGen's idea. Y < 50 stops the button press from moving the character and once the inventory is open I have the attribute true and he won't move if it's true.

    If anyone knows how I can get the button to completely disable his movement when it is pressed and re-enable it once it is pressed again, I think that would solve my problems the best.
  • BRGKeenBRGKeen Member Posts: 40
    I found another solution. Since the movement mat is invisible, I put two on the screen and that way I created a zone around my inventory button that was not movable. Downside is not I have 2 stationary invisible actors on each scene but I don't think that negatively impact performance, does it?

    Downside of this solution is that once he is moving, game.move is 1 and if he's still moving I can click the button area and he'll move to it.
Sign In or Register to comment.