Please help with this ASAP :)
rickyniko
Member Posts: 85
Ok so we all remember super mario right? as an example, when the turtle ran into you, you would lose a life, and start from the checkpoint again, but if you where to jump ON it, you would kill it, is there a way to do something like this on GS
so if actor 2 walks into actor 1, you die, and if actor 1 jumps onto actor 2, actor 2 dies?
so if actor 2 walks into actor 1, you die, and if actor 1 jumps onto actor 2, actor 2 dies?
Comments
1 for the front/back, and 1 for the top.
Then you can set if actor 1 collides with front/back then X, and if actor 1 collides with top then Y.
// Red Dot Inc
what I use, and works perfect, require the use of instances or only one constrain.
If you use instances, on the monster:
Rule
"when actor collides with Hero"
Rule
if hero self.position Y is greater than self.position Y of the monster + self height / 2 of the monster
Put in here rules that kill the monster
Otherwise
put in here rules that kill the hero
With only prototype, you need to constrain attribute self.position Y to a game attribute, so that the foes can see the Y position of the hero. In this constrain, you can have something like
constrain game.positionYofHero to self.positionY-self.height of the hero / 2, so that actually the Y the game check's is the one at the feet of the hero, and not at the center of him, so it's easier to think about the correct "greater and less" to check if it's on top of the monster or not.
Everything else is basically the same.
With instances, there's a constrain less, always good for perfomance.
Check if player is moving down through the air. As in
If [self.Motion.Linear.Velocity.Y < 0] AND [if actor collides with Actor 2] then kill monster.
That means, if you're jumping and colliding with the enemy then you'll kill it. It also means you won't kill it if you jump just before it and hit it on the way up. Which I believe is the way Mario works too.
When I made a platform I used the compare the lower Y of the actor and the top Y of the enemy method and built in a slight buffer because the actor was moving more than 1 pixel per frame.