Actors hiding behind foreground can still be "touched"

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

I'm just starting out with GS and the first real issue that I can't seem solve is how actors still gets triggered by the "touch is pressed" condition even though they can't be seen.

I want to be able to kill an actor by touching it, but not if the actor is hiding behind something in the foreground.

How do I solve that?

I realize that this might be something really obvious and basic since I've recently started out, and in that case I apologize for taking up forum space.

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    I would say make a smaller actor behind the foreground that the actor will bump into if it goes behind the foreground. Then make a rule saying if actor collides with the actor behind the foreground, do nothing. Otherwise, when touch is pressed, destroy actor. That should work.
    Asymptoteell
  • quantumsheepquantumsheep Member Posts: 8,188
    You could have two states - hidden and exposed.

    So, your actor, when hidden, gets moved off screen completely.

    He then gets put back to his position when 'exposed' so you can click him.

    Hope that helps,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • stryktipsstryktips Member Posts: 3
    Thanks for your replies. If I understand both your solutions correctly this will only make the actor either hidden or fully visible, but I still want to be able to kill the actor by touching the part that is still visible when the actor is only partially hidden behind an object.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    If you make a game attribute that tracks if a foreground actor has touch inside, and the actor you kill checks if that attribute it true and if it is touched, then it destroys itself.
  • stryktipsstryktips Member Posts: 3
    Great idea! I'll try that.
Sign In or Register to comment.