Die colliding with sides but not top
LyboTech
Member Posts: 135
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
Answers
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.
@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
@Tosanu, I've used both techniques too. There is always more than one way to get a job done I guess.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@Tosanu @jamie_c Thanks both of you, my game is now almost finished
@LyboTech, that's great. Coming down the home stretch is exciting and exhausting!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Yeah, just keep running that last mile and ignore all the internal screaming. Good luck!