All pastes #71686 Raw Edit

Vic

public text v1 · immutable
#71686 ·published 2006-06-26 01:07 UTC
rendered paste body
// if by "early" you mean it's colliding before the Sprites are touching
// this is because rectCollision checks the bounds of the Sprite, not texture.
// one thing you can do is give the Sprite allowances.

// this only needs to be done once:

myFirstSprite.tAllowance = .2f;// allow .2 units in from the top
// can also be done bottom, left, right


 else if (inpMan.KeyDown(Key.Down))
 {
       // to consider allowances, you need to call the right method:

//       if(!Collisions.rectCollisionMove(myFirstSprite, gS))
       if(!Collisions.rectCollisionMoveAllowance(myFirstSprite, gS))
            myFirstSprite.yVelocity = -5;
 }