public override void onCollide(BasicSprite collided) { base.onCollide(collided); // The Gentleman picked up the key if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { container.Remove(this); hud.addKey(this); onHUD = true; double angle = Math.Atan2(5 - spritePos.Y, 745 - spritePos.X) * 180.0 / Math.PI; velocity = Velocity.FromDirection((float)angle, 10.0f); timer.Start(); } }
public override void onCollide(BasicSprite collided, Rectangle data, GameTime time) { base.onCollide(collided, data, time); // The Gentleman picked up the key if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { container.Remove(this); hud.addKey(this); onHUD = true; double angle = Math.Atan2(10 - spritePos.Y, game.GraphicsDevice.Viewport.Width - 52 - spritePos.X) * 180.0 / Math.PI; velocity = Velocity.FromDirection((float)angle, 10.0f); timer.Start(); } }
public override void onCollide(BasicSprite collided, Rectangle data, GameTime time) { base.onCollide(collided, data, time); if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { ((TheGentleman)collided).health -= damage; } if (collided.collidable) { if (data.Width <= 0) { this.velocity = Velocity.FromDirection(0.0f, 0.0f); } } }
public override void onCollide(BasicSprite collided, Rectangle data, GameTime time) { base.onCollide(collided, data, time); // The Gentleman pushs into a box if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { if (data.Width <=0) { this.velocity = Velocity.FromDirection(0.0f, 0.5f); }else if (data.Width>=0) { this.velocity = Velocity.FromDirection(0.0f, 0.5f); } } }
public override void onCollide(BasicSprite collided, Rectangle data, GameTime time) { base.onCollide(collided, data, time); //Seeing if security hit the Gentleman if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { //call method to handle damage and effects } //Checking to see if security hit a object if (collided.collidable) { if (data.Width <= 0) { this.velocity = Velocity.FromDirection(0.0f, 0.0f); } } }
public override void onCollide(BasicSprite collided, Rectangle data, GameTime time) { base.onCollide(collided, data, time); //Seeing if security hit the Gentleman if (collided.ToString() == "KeysToInsanity.Code.TheGentleman") { TheGentleman tg = (TheGentleman)collided; if (!tg.invincible) { tg.health -= damage; } } if (collided.collidable) { if (data.Width <= 0) { velocity = Velocity.FromCoordinates(-velocity.getX(), 0.0f); } } }