SHARE
TWEET

Untitled

a guest Jun 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void ValidateVerticalPosition()
  2.         {
  3.             // if hit od gore (ili dole?) currentJump=0
  4.             // if hit od dole isDoubleJumping = false
  5.  
  6.             foreach(Rectangle boundary in Boundaries)
  7.             {
  8.                 bool collisionAbove = Collisions(Hero.Character, boundary)[0];
  9.                 if (collisionAbove && Hero.Character.IntersectsWith(boundary))
  10.                 {
  11.                     currentJump = 0;
  12.                     Hero.Character = new RectangleF(Hero.Character.X, boundary.Bottom + 0.1f, Hero.Character.Width, Hero.Character.Height);
  13.                     break; // might bug, check out later
  14.                 }
  15.  
  16.                 bool collisionBelow = Collisions(Hero.Character, boundary)[1];
  17.                 if (collisionBelow && Hero.Character.IntersectsWith(boundary))
  18.                 {
  19.                     isDoubleJumping = false;
  20.                     Hero.Character = new RectangleF(Hero.Character.X, boundary.Top - 0.5f - Hero.Character.Height, Hero.Character.Width, Hero.Character.Height);
  21.                     break; // read above
  22.                 }
  23.             }
  24.         }
  25.  
  26.  
  27. public void GravityPull()
  28.         {
  29.             if (currentJump == 0 && HeroIsInAir())
  30.             {
  31.                 Hero.Fall();
  32.             }
  33.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top