public Rectangle Winning(Mario.PowerStateType power) { Rectangle source = new Rectangle(new Point(0, winYPos), new Point(winWidth, normalWinHeight)); if (power != Mario.PowerStateType.Normal) { source.Height = superWinHeight; } return(source); }
public static void Walking(ref Rectangle source, int frame, Mario.PowerStateType power, Mario.ActionStateType walkingDir) { if (frame == 0) { if (power != Mario.PowerStateType.Normal) { source.Width = WalkingSuperWidth; source.X = 0; source.Y = SuperMarioStart; if (power == Mario.PowerStateType.Fire) { source.Y = FireMarioStart; } } else { source.Width = IdleWidthNormal; source.X = 0; source.Y = NormalMarioStart; } } else if (frame == 1) { if (power != Mario.PowerStateType.Normal) { source.Width = WalkingSuperWidth; source.X = SuperFrame2; source.Y = SuperMarioStart; if (power == Mario.PowerStateType.Fire) { source.Y = FireMarioStart; } } else { source.Width = IdleWidthNormal; source.X = NormalFrame2; source.Y = NormalMarioStart; } } else { if (power != Mario.PowerStateType.Normal) { source.Width = WalkingSuperWidth; source.X = SuperFrame3; source.Y = SuperMarioStart; if (power == Mario.PowerStateType.Fire) { source.Y = FireMarioStart; } } else { source.Width = IdleWidthNormal; source.X = NormalFrame3; source.Y = NormalMarioStart; } } if (walkingDir == Mario.ActionStateType.WalkingRight) { source.X += RightFacingStart; } }
public static void ShellWalking(ref Rectangle source, int frame, Mario.PowerStateType power, Mario.ActionStateType walkingDir) { if (frame == 0) { if (power != Mario.PowerStateType.Normal) { source.Width = ShellSuperWidth; source.X = 0; source.Height = ShellSuperHeight; if (power == Mario.PowerStateType.Fire) { source.Y = ShellFire; } else { source.Y = ShellSuper; } } else { source.Width = ShellNormalWidth; source.X = 0; source.Y = ShellNormal; source.Height = ShellNormalHeight; } } else if (frame == 1) { if (power != Mario.PowerStateType.Normal) { source.Width = ShellNormalWidth; source.X = ShellNormalWidth; source.Y = ShellSuper; source.Height = RunningSuperHeight; if (power == Mario.PowerStateType.Fire) { source.Y = ShellFire; } } else { source.Width = ShellNormalWidth; source.X = ShellNormalWidth; source.Y = ShellNormal; source.Height = ShellNormalHeight; } } else { if (power != Mario.PowerStateType.Normal) { source.Width = ShellSuperWidth; source.X = 2 * ShellSuperWidth; source.Y = ShellSuper; source.Height = ShellSuperHeight3; if (power == Mario.PowerStateType.Fire) { source.Y = ShellFire; } } else { source.Width = ShellNormalWidth; source.X = ShellNormalWidth * 2; source.Y = ShellNormal; source.Height = ShellNormalHeight3; } } if (walkingDir == Mario.ActionStateType.WalkingRight) { source.X += RightFacingStart; } }
public static void SetSourceRectangle(ref Rectangle source, Mario.PowerStateType power, Mario.ActionStateType action) { Point location = new Point(); Point size = new Point(); if (source.X >= RightFacingStart) { location.X = RightFacingStart; } else { location.X = 0; } //set the location to the beginning of the 'set' of sprites for each power state switch (power) { case Mario.PowerStateType.Normal: location.Y = NormalMarioStart; size.X = IdleWidthNormal; size.Y = IdleHeightNormal; break; case Mario.PowerStateType.Super: location.Y = SuperMarioStart; size.X = IdleWidthSuper; size.Y = IdleHeightSuper; break; case Mario.PowerStateType.Fire: location.Y = FireMarioStart; size.X = IdleWidthSuper; size.Y = IdleHeightSuper; break; case Mario.PowerStateType.Dead: location.Y = DeadMarioStart; location.X = 0; size.X = DeadWidth; size.Y = DeadHeight; break; } switch (action) { case Mario.ActionStateType.WalkingLeft: if (location.Y > SuperMarioStart) { size.X = IdleWidthSuper; } break; case Mario.ActionStateType.WalkingRight: location.X = RightFacingStart; if (location.Y > SuperMarioStart) { size.X = IdleWidthSuper; } break; case Mario.ActionStateType.Jumping: switch (power) { case Mario.PowerStateType.Normal: location.Y = NormalMarioJump; size.Y = JumpHeightNormal; break; case Mario.PowerStateType.Super: location.Y = SuperMarioJump; size.Y = JumpHeightSuper; break; case Mario.PowerStateType.Fire: location.Y = FireMarioJump; size.Y = JumpHeightSuper; break; } size.X = JumpWidth; break; case Mario.ActionStateType.Crouching: switch (power) { case Mario.PowerStateType.Normal: location.Y = NormalMarioCrouch; size.Y = CrouchHeightNormal; size.X = CrouchWidthNormal; break; case Mario.PowerStateType.Super: location.Y = SuperMarioCrouch; size.Y = CrouchHeightSuper; size.X = CrouchWidthSuper; break; case Mario.PowerStateType.Fire: location.Y = FireMarioCrouch; size.Y = CrouchHeightSuper; size.X = CrouchWidthSuper; break; } break; case Mario.ActionStateType.HoldingShell: switch (power) { case Mario.PowerStateType.Normal: location.Y = ShellNormal; size.Y = ShellNormalHeight; size.X = ShellNormalWidth; break; case Mario.PowerStateType.Super: location.Y = ShellSuper; size.Y = ShellSuperHeight; size.X = ShellNormalWidth; break; case Mario.PowerStateType.Fire: location.Y = ShellFire; size.Y = ShellSuperHeight; size.X = ShellSuperWidth; break; } break; } source.Location = location; source.Size = size; }