Access to the "If Touch Is Pressed" attribute?

vikingviking Member, PRO Posts: 322

Hey forumers!

Does anyone know if it is possible to change the If Touch Is Pressed toggle in an actor without actually touching it? I would like to use actor (a) to receive the touch from the player and then change a game.TouchAttribute from False to True. Then if game.TouchAttribute is True then change If Touch Is Pressed to True in actor (b).

Best Answers

  • HopscotchHopscotch Posts: 2,782
    Accepted Answer

    Hi @viking :) ,

    how is that different from waiting for a user to activate the touch?

    If I understand you correctly, you want rules in separate actors to trigger if the user touches a certain actor, no?

    So using a game state attribute would be the way to go.

  • vikingviking Posts: 322
    Accepted Answer

    Good question :)

    I need actor (b) If Touch Is Pressed to change from False to True when actor (a) is touched - even if actor (b) was never touched. I can use a game state attribute in the Or section, but then I would have to redo a million lines of code, which is what I am trying to avoid.

    If I could just switch the If Touch Is Pressed using a change Attribute it would be a lot easier. But I think you are right in that it is not possible to change this state unless you touch the actor.

Answers

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @viking how about using the following rule in actor(b)

    Rule (any)
    if touch is pressed
    or
    if game.TouchAttribute = true

    ...

    end rule

    I do not know of a way to set Touch to true

  • vikingviking Member, PRO Posts: 322

    Hi there @Hopscotch :) I don't think that will work because most of the logic in actor (b) is waiting for Touch Is Pressed to be True before it can fire.

Sign In or Register to comment.