Die colliding with sides but not top

As a followup to my earlier question today I am wondering how this would work.

How can my actor live when touching the green side of the actor but trigger the
dead attribute when touching the red

Thanks for any help :blush:

Best Answer

Answers

  • TosanuTosanu Member, PRO Posts: 388

    My preferred method is to use a bounding box actor.

    What i do is first make game attributes to check the x and y position of the actor (lets say PlayerX and PlayerY) and a boolean that says "isdead".

    I then create a second, invisible actor. This actor is constrained to positions related to the PlayerX and Y so that it extends just slightly to the sides of the actor without going through the bottom. (or whichever sides of the actors need to touch something to trigger the special condition.)

    That actor is your collision box. It should have the rule "If collides with Killblock, switch IsDead to true" and the player actor should have "If IsDead is true"- do whatever process needs to happen when your character dies.

    There are other options, such as creating a position comparison behavior on the killblock or whatever it is, but i find i like these the best, since the bounding actors can be used for a wide variety of tasks and involve less math in general.

  • TosanuTosanu Member, PRO Posts: 388

    @jamie_c, yes that's the other option i was thinking of, I didn't describe it well. But i've kinda become obsessed with collision boxes and their potential so that's why I ran with that one, ever since it was first suggested to me. For this task, I imagine either option would work for @LyboTech‌

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @Tosanu, I've used both techniques too. There is always more than one way to get a job done I guess. :)

  • LyboTechLyboTech Member Posts: 135

    @Tosanu‌ @jamie_c‌ Thanks both of you, my game is now almost finished :)

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @LyboTech, that's great. Coming down the home stretch is exciting and exhausting! :)

  • TosanuTosanu Member, PRO Posts: 388

    Yeah, just keep running that last mile and ignore all the internal screaming. Good luck!

Sign In or Register to comment.