private void CheckAndHandleSpringLaunch(int mapX, int mapY) { if (_map.CellIsOccupied(mapX, mapY)) { SpringBlock launcher = _map.GetTile(mapX, mapY) as SpringBlock; if ((launcher != null) && (launcher.HasBeenLandedOnSquarely(WorldPosition))) { HandleSpringBlockLaunch(launcher); } } }
private void HandleSolidBlockCollision(Block collidingBlock) { _hasLandedOnBlock = true; _isSmashingSmashBlocks = false; if (collidingBlock.HasBeenLandedOnSquarely(WorldPosition)) { _motionEngine.PlayerIsOnGround = true; _didNotLandSafely = false; if (_motionEngine.Delta.Y > 0) { WorldPosition -= new Vector2(0.0f, WorldPosition.Y - (collidingBlock.TopSurfaceY - Body_Collision_Radius)); bool specialBlock = false; SpringBlock launcher = collidingBlock as SpringBlock; if (launcher != null) { HandleSpringBlockLaunch(launcher); specialBlock = true; } if (!specialBlock) { IceBlock ice = collidingBlock as IceBlock; if (ice != null) { HandleIceBlockImpact(); specialBlock = true; } } if (!specialBlock) { BombBlock bomb = collidingBlock as BombBlock; if (bomb != null) { HandleBombBlockImpact(bomb); } } } } else if ((CornerHasBeenClipped(collidingBlock.LeftSurfaceX, collidingBlock.TopSurfaceY)) || (CornerHasBeenClipped(collidingBlock.RightSurfaceX, collidingBlock.TopSurfaceY))) { _hasLandedOnBlock = false; } else if ((FacingAwayFromBlock(collidingBlock)) && (WorldPosition.Y < collidingBlock.WorldPosition.Y)) { if (Math.Abs(WorldPosition.X - (collidingBlock.WorldPosition.X + (collidingBlock.CollisionBoundingBox.Width / 2.0f))) < Rear_Edge_Clip_Tolerance) { _motionEngine.PlayerIsOnGround = true; } _didNotLandSafely = false; } }
private void HandleSpringBlockLaunch(SpringBlock launcher) { SoundEffectManager.PlayEffect("spring-launch"); _motionEngine.SetForBoostedJump(); launcher.TriggerLaunchAnimation(); }