Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ValidateVerticalPosition()
- {
- // if hit od gore (ili dole?) currentJump=0
- // if hit od dole isDoubleJumping = false
- foreach(Rectangle boundary in Boundaries)
- {
- bool collisionAbove = Collisions(Hero.Character, boundary)[0];
- if (collisionAbove && Hero.Character.IntersectsWith(boundary))
- {
- currentJump = 0;
- Hero.Character = new RectangleF(Hero.Character.X, boundary.Bottom + 0.1f, Hero.Character.Width, Hero.Character.Height);
- break; // might bug, check out later
- }
- bool collisionBelow = Collisions(Hero.Character, boundary)[1];
- if (collisionBelow && Hero.Character.IntersectsWith(boundary))
- {
- isDoubleJumping = false;
- Hero.Character = new RectangleF(Hero.Character.X, boundary.Top - 0.5f - Hero.Character.Height, Hero.Character.Width, Hero.Character.Height);
- break; // read above
- }
- }
- }
- public void GravityPull()
- {
- if (currentJump == 0 && HeroIsInAir())
- {
- Hero.Fall();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement