Skip to content
Browse files

Dynamically figure out main menu level

  • Loading branch information...
1 parent 8c77eb4 commit 71e6fcb98da6c94c7f1b7cbdfd7ab4cf5df086d0 @DizWARE DizWARE committed
View
58 ...360/GravityShiftXbox360/GravityShiftXbox360/Game Objects/Physics Objects/PhysicsObject.cs
@@ -139,13 +139,23 @@ public void ApplyImmediateForce(Vector2 force)
/// <summary>
/// TEMP METHOD - WILL GIVE THE PLAYER THE ABILITY TO FALL FROM ONE END OF THE SCREEN TO THE OTHER
/// </summary>
- public void FixForBounds(int width, int height)
+ public void FixForBounds(int width, int height, bool isFixed)
{
- if (mPosition.X < 0) mPosition.X += width;
- if (mPosition.Y < 0) mPosition.Y += height;
+ if (!isFixed)
+ {
+ if (mPosition.X < 0) mPosition.X += width;
+ if (mPosition.Y < 0) mPosition.Y += height;
+
+ mPosition.X %= width;
+ mPosition.Y %= height;
+ return;
+ }
- mPosition.X %= width;
- mPosition.Y %= height;
+ if (mPosition.X < 0) { mPosition.X = 0; mVelocity = new Vector2();}
+ if (mPosition.Y < 0) {mPosition.Y = 0; mVelocity = new Vector2();}
+ if (mPosition.X + this.mBoundingBox.Width > width) {mPosition.X = width - this.mBoundingBox.Width; mVelocity = new Vector2();}
+ if (mPosition.Y + this.mBoundingBox.Height > height) { mPosition.Y = height - this.mBoundingBox.Height; mVelocity = new Vector2(); }
+
}
/// <summary>
@@ -696,26 +706,18 @@ public virtual int HandleCollideCircleAndBox(GameObject otherObject)
Point centerB = new Point();
if ((center.X < p[0].X) && (center.Y < p[0].Y))// top left corner
{
- // and no tile is above me or to the left!!!!!!!!!!!!!!!!!!!!!!!!!TODO
- // else return HandleCollideBoxAndBox(otherObject);
centerB = p[0];
}
else if ((center.X > p[1].X) && (center.Y < p[1].Y))// top right corner
{
- // and no tile is above me or to the right!!!!!!!!!!!!!!!!!!!!!!!!!TODO
- // else return HandleCollideBoxAndBox(otherObject);
centerB = p[1];
}
else if ((center.X > p[2].X) && (center.Y > p[2].Y))// bottom right corner
{
- // and no tile is below me or to the right!!!!!!!!!!!!!!!!!!!!!!!!!TODO
- // else return HandleCollideBoxAndBox(otherObject);
centerB = p[2];
}
else if ((center.X < p[3].X) && (center.Y > p[3].Y))// bottom left corner
{
- // and no tile is below me or to the left!!!!!!!!!!!!!!!!!!!!!!!!!TODO
- // else return HandleCollideBoxAndBox(otherObject);
centerB = p[3];
}
@@ -727,35 +729,7 @@ public virtual int HandleCollideCircleAndBox(GameObject otherObject)
centerDiff.Normalize();
Vector2 add = Vector2.Multiply(centerDiff, delta);
-
- // normal of the collision
- Vector2 N = centerDiff;
- N.Normalize();
- // tangent of the collision
- Vector2 T = new Vector2(N.Y, -N.X);
-
- float e = 0.9f;//0.9f; // elasticity of the collision
-
- float vain = Vector2.Dot(this.mVelocity, N);
- float vait = Vector2.Dot(this.mVelocity, T);
-
- float vbin = Vector2.Dot(Vector2.Zero, N);
- float vbit = Vector2.Dot(Vector2.Zero, T);
-
- float vafn = ((e + 1.0f) * vbin + vain * (1 - e)) / 2;
- float vbfn = ((e + 1.0f) * vain - vbin * (1 - e)) / 2;
- float vaft = vait;
- float vbft = vbit;
-
- if (!mIsRail)
- {
- this.mVelocity.X = vafn * N.X + vaft * T.X;
- this.mVelocity.Y = vafn * N.Y + vaft * T.Y;
- }
- else if (mOriginalInfo.mProperties[XmlKeys.RAIL] == XmlKeys.RAIL_X)
- this.mVelocity.X = vafn * N.X + vaft * T.X;
- else
- this.mVelocity.Y = vafn * N.Y + vaft * T.Y;
+ //Do not change velocity because we want an inelastic collision on corners.
// place the Y pos just so it is not colliding.
if (!mIsRail)
View
47 GravityShiftXbox360/GravityShiftXbox360/GravityShiftXbox360/GravityShiftMain.cs
@@ -138,9 +138,8 @@ protected override void Initialize()
mTitle = new Title(mControls, mGraphics);
mMainMenu = new MainMenu(mControls, mGraphics);
- mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport);
-
- mMenu = new Menu(mControls, mGraphics);
+
+ //mMenu = new Menu(mControls, mGraphics);
mScoring = new Scoring(mControls);
mWorldSelect = new WorldSelect(mControls, mGraphics);
@@ -183,12 +182,14 @@ protected override void LoadContent()
mTitle.Load(Content, mGraphics.GraphicsDevice);
- mMainMenuLevel.Load(Content);
mMainMenu.Load(Content);
+ mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport, mMainMenu.GetInnerRegion());
+
+ mMainMenuLevel.Load(Content);
mCredits.Load(Content);
mOptions.Load(Content);
- mMenu.Load(Content, mGraphics.GraphicsDevice);
+ //mMenu.Load(Content, mGraphics.GraphicsDevice);
mScoring.Load(Content, mGraphics.GraphicsDevice);
mPause.Load(Content);
GameSound.Load(Content);
@@ -645,7 +646,7 @@ public void DrawHUD()
//HUDTrans block
mSpriteBatch.Draw(mHUDTrans, new Rectangle(mScreenRect.Left, mScreenRect.Bottom - (int)mLives[0].Height - 10,
- (int)livesLength.X + (int)mLives[0].Width * (mCurrentLevel.NumLives+1), (int)mLives[0].Height + 5), Color.White);
+ (int)livesLength.X + (int)(mLives[0].Width * 0.75f) * (mCurrentLevel.NumLives+1), (int)mLives[0].Height + 5), Color.White);
//Number lives
placement = new Vector2(mScreenRect.Left + 10, mScreenRect.Bottom - (int) mLives[0].Height - 10);
@@ -656,39 +657,37 @@ public void DrawHUD()
placement = new Vector2(mScreenRect.Left + livesLength.X, mScreenRect.Bottom - (int)mLives[0].Height - 10);
if (mCurrentLevel.NumLives == 5)
{
- mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + mLives[0].Width), (int) placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 2 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 3 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 4 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 5 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
+ mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int) placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 2 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 3 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 4 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[5], new Rectangle((int)(placement.X + 5 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
else if (mCurrentLevel.NumLives == 4)
{
- mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 2 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 3 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 4 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
-
+ mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 2 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 3 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[4], new Rectangle((int)(placement.X + 4 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
else if (mCurrentLevel.NumLives == 3)
{
- mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + 2 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + 3 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
-
+ mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + 2 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[3], new Rectangle((int)(placement.X + 3 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
else if (mCurrentLevel.NumLives == 2)
{
- mSpriteBatch.Draw(mLives[2], new Rectangle((int)(placement.X + mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
- mSpriteBatch.Draw(mLives[2], new Rectangle((int)(placement.X + 2 * mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
+ mSpriteBatch.Draw(mLives[2], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
+ mSpriteBatch.Draw(mLives[2], new Rectangle((int)(placement.X + 2 * (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
else if (mCurrentLevel.NumLives == 1)
{
- mSpriteBatch.Draw(mLives[1], new Rectangle((int)(placement.X + mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
+ mSpriteBatch.Draw(mLives[1], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
else if (mCurrentLevel.NumLives == 0)
{
- mSpriteBatch.Draw(mLives[0], new Rectangle((int)(placement.X + mLives[0].Width), (int)placement.Y, (int)(mLives[0].Width * 0.75f), (int)(mLives[0].Height * 0.75f)), Color.White);
+ mSpriteBatch.Draw(mLives[0], new Rectangle((int)(placement.X + (mLives[0].Width * 0.75f)), (int)placement.Y, (int)(mLives[0].Width * 0.6f), (int)(mLives[0].Height * 0.6f)), Color.White);
}
View
5 GravityShiftXbox360/GravityShiftXbox360/GravityShiftXbox360/Import Code/Importer.cs
@@ -61,7 +61,7 @@ public Level ImportLevel(Level level)
{
if (item.Name == XmlKeys.NAME)
level.Name = item.Value;
- if (item.Name == XmlKeys.SIZE)
+ if (item.Name == XmlKeys.SIZE && !level.IsMainMenu)
level.Size = GridSpace.GetDrawingCoord(new Vector2(int.Parse(item.Attribute(XName.Get("X", "")).Value),
int.Parse(item.Attribute(XName.Get("Y", "")).Value)));
if (item.Name == XmlKeys.BACKGROUND)
@@ -71,7 +71,8 @@ public Level ImportLevel(Level level)
mEntities.Add(new EntityInfo(element));
}
- GetPlayerStart(level);
+ if(!level.IsMainMenu)
+ GetPlayerStart(level);
return level;
}
View
13 GravityShiftXbox360/GravityShiftXbox360/GravityShiftXbox360/Level.cs
@@ -100,9 +100,14 @@ private enum DeathStates
private float mDeathPanUpdates;
private static float SCALING_FACTOR = 85;
+
private bool isCameraFixed = false;
private bool shouldAnimate = true;
+ public bool IsMainMenu
+ {
+ get { return isCameraFixed; }
+ }
// Camera
public static Camera mCam;
@@ -457,7 +462,7 @@ public void Update(GameTime gameTime, ref GameStates gameState)
{
PhysicsObject pObject = (PhysicsObject)gObject;
- pObject.FixForBounds((int)Size.X, (int)Size.Y);
+ pObject.FixForBounds((int)Size.X, (int)Size.Y, isCameraFixed);
Vector2 oldPos = GridSpace.GetGridCoord(pObject.mPosition);
if (pObject is Player)
@@ -467,7 +472,7 @@ public void Update(GameTime gameTime, ref GameStates gameState)
pObject.Update(gameTime);
// Update zoom based on players velocity
- pObject.FixForBounds((int)Size.X, (int)Size.Y);
+ pObject.FixForBounds((int)Size.X, (int)Size.Y, isCameraFixed);
UpdateCollisionMatrix(pObject, oldPos);
// handle collision right after you move
@@ -982,11 +987,13 @@ private AnimatedSprite GetAnimation(string name)
return newAnimation;
}
- public static Level MainMenuLevel(string filepath, IControlScheme controls, Viewport viewport)
+ public static Level MainMenuLevel(string filepath, IControlScheme controls, Viewport viewport, Rectangle region)
{
Level main = new Level(filepath,controls,viewport);
main.isCameraFixed = true;
main.shouldAnimate = false;
+ main.Size = new Vector2(region.Width*33/32, region.Height*7/8);
+ main.mStartingPoint = new Vector2(region.Width/2, region.Height/8);
return main;
}
}
View
16 GravityShiftXbox360/GravityShiftXbox360/GravityShiftXbox360/Menu Code/MainMenu.cs
@@ -146,5 +146,21 @@ public Rectangle GetRegion(MenuChoices choice, Texture2D texture)
viewport.TitleSafeArea.Center.Y + (int)(mTitle.Height * mSize[1]) / 2 - ((int)(texture.Height * mSize[1]) / 2), (int)(texture.Width * mSize[0]), (int)(texture.Height * mSize[1]));
return new Rectangle();
}
+
+ /// <summary>
+ /// Gets the rectangle between the menu options
+ /// </summary>
+ /// <returns>Rectangle between menu choices</returns>
+ public Rectangle GetInnerRegion()
+ {
+ Rectangle topRectangle = GetRegion(MenuChoices.Exit, mSelected[MenuChoices.Exit]);
+ Rectangle leftRectangle = GetRegion(MenuChoices.Credits, mSelected[MenuChoices.Credits]);
+ Rectangle rightRectangle = GetRegion(MenuChoices.Options, mSelected[MenuChoices.Options]);
+ Rectangle bottomRectangle = GetRegion(MenuChoices.StartGame, mSelected[MenuChoices.StartGame]);
+
+ Rectangle region = new Rectangle(leftRectangle.Left, topRectangle.Top,
+ rightRectangle.Right - leftRectangle.Left,bottomRectangle.Bottom - topRectangle.Top);
+ return region;
+ }
}
}
View
360 GravityShiftXbox360/GravityShiftXbox360/GravityShiftXbox360Content/Levels/MainMenu.xml
@@ -16,365 +16,5 @@
<IdealTime>400</IdealTime>
</Properties>
</Entity>
- <Entity>
- <ID>1101</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1102</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="1" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1103</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="2" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1104</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="3" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1105</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="4" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1106</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="5" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1107</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="6" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1108</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="7" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1109</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="8" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1110</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="2" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1111</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="3" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1112</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="4" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1113</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="5" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1114</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="6" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1115</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="7" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1116</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="8" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1117</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1118</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="8" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1119</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="7" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1120</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="6" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1121</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="5" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1122</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="3" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1123</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="2" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1124</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="1" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1125</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1126</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="7" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1127</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="6" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1128</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="5" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1129</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="4" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1130</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="3" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1131</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="2" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1132</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="1" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1133</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="8" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1135</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="4" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1137</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="1" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1138</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
</Entities>
</Level>
View
BIN GravityShiftXbox360/Mr. Gravity.suo
Binary file not shown.
View
360 WindowsGame1/Content/Levels/MainMenu.xml
@@ -16,365 +16,5 @@
<IdealTime>400</IdealTime>
</Properties>
</Entity>
- <Entity>
- <ID>1101</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1102</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="1" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1103</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="2" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1104</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="3" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1105</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="4" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1106</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="5" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1107</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="6" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1108</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="7" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1109</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="8" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1110</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="2" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1111</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="3" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1112</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="4" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1113</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="5" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1114</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="6" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1115</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="7" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1116</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="8" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1117</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1118</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="8" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1119</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="7" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1120</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="6" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1121</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="5" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1122</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="3" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1123</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="2" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1124</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="1" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1125</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1126</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="7" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1127</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="6" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1128</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="5" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1129</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="4" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1130</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="3" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1131</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="2" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1132</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="1" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1133</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="0" Y="8" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1135</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="4" Y="9" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1137</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="1" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
- <Entity>
- <ID>1138</ID>
- <Name>Invisible</Name>
- <Type>Walls</Type>
- <Location X="9" Y="0" />
- <CollisionType>Normal</CollisionType>
- <Paintable>True</Paintable>
- <Texture>InvisibleObjects\InvisibleBlock</Texture>
- <Properties />
- </Entity>
</Entities>
</Level>
View
20 WindowsGame1/Game Objects/Physics Objects/PhysicsObject.cs
@@ -139,13 +139,23 @@ public void ApplyImmediateForce(Vector2 force)
/// <summary>
/// TEMP METHOD - WILL GIVE THE PLAYER THE ABILITY TO FALL FROM ONE END OF THE SCREEN TO THE OTHER
/// </summary>
- public void FixForBounds(int width, int height)
+ public void FixForBounds(int width, int height, bool isFixed)
{
- if (mPosition.X < 0) mPosition.X += width;
- if (mPosition.Y < 0) mPosition.Y += height;
+ if (!isFixed)
+ {
+ if (mPosition.X < 0) mPosition.X += width;
+ if (mPosition.Y < 0) mPosition.Y += height;
- mPosition.X %= width;
- mPosition.Y %= height;
+ mPosition.X %= width;
+ mPosition.Y %= height;
+ return;
+ }
+
+ if (mPosition.X < 0) { mPosition.X = 0; mVelocity = new Vector2();}
+ if (mPosition.Y < 0) {mPosition.Y = 0; mVelocity = new Vector2();}
+ if (mPosition.X + this.mBoundingBox.Width > width) {mPosition.X = width - this.mBoundingBox.Width; mVelocity = new Vector2();}
+ if (mPosition.Y + this.mBoundingBox.Height > height) { mPosition.Y = height - this.mBoundingBox.Height; mVelocity = new Vector2(); }
+
}
/// <summary>
View
11 WindowsGame1/GravityShiftMain.cs
@@ -138,9 +138,8 @@ protected override void Initialize()
mTitle = new Title(mControls, mGraphics);
mMainMenu = new MainMenu(mControls, mGraphics);
- mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport);
-
- mMenu = new Menu(mControls, mGraphics);
+
+ //mMenu = new Menu(mControls, mGraphics);
mScoring = new Scoring(mControls);
mWorldSelect = new WorldSelect(mControls, mGraphics);
@@ -183,12 +182,14 @@ protected override void LoadContent()
mTitle.Load(Content, mGraphics.GraphicsDevice);
- mMainMenuLevel.Load(Content);
mMainMenu.Load(Content);
+ mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", mControls, mGraphics.GraphicsDevice.Viewport, mMainMenu.GetInnerRegion());
+
+ mMainMenuLevel.Load(Content);
mCredits.Load(Content);
mOptions.Load(Content);
- mMenu.Load(Content, mGraphics.GraphicsDevice);
+ //mMenu.Load(Content, mGraphics.GraphicsDevice);
mScoring.Load(Content, mGraphics.GraphicsDevice);
mPause.Load(Content);
GameSound.Load(Content);
View
5 WindowsGame1/Import Code/Importer.cs
@@ -61,7 +61,7 @@ public Level ImportLevel(Level level)
{
if (item.Name == XmlKeys.NAME)
level.Name = item.Value;
- if (item.Name == XmlKeys.SIZE)
+ if (item.Name == XmlKeys.SIZE && !level.IsMainMenu)
level.Size = GridSpace.GetDrawingCoord(new Vector2(int.Parse(item.Attribute(XName.Get("X", "")).Value),
int.Parse(item.Attribute(XName.Get("Y", "")).Value)));
if (item.Name == XmlKeys.BACKGROUND)
@@ -71,7 +71,8 @@ public Level ImportLevel(Level level)
mEntities.Add(new EntityInfo(element));
}
- GetPlayerStart(level);
+ if(!level.IsMainMenu)
+ GetPlayerStart(level);
return level;
}
View
13 WindowsGame1/Level.cs
@@ -100,9 +100,14 @@ private enum DeathStates
private float mDeathPanUpdates;
private static float SCALING_FACTOR = 85;
+
private bool isCameraFixed = false;
private bool shouldAnimate = true;
+ public bool IsMainMenu
+ {
+ get { return isCameraFixed; }
+ }
// Camera
public static Camera mCam;
@@ -457,7 +462,7 @@ public void Update(GameTime gameTime, ref GameStates gameState)
{
PhysicsObject pObject = (PhysicsObject)gObject;
- pObject.FixForBounds((int)Size.X, (int)Size.Y);
+ pObject.FixForBounds((int)Size.X, (int)Size.Y, isCameraFixed);
Vector2 oldPos = GridSpace.GetGridCoord(pObject.mPosition);
if (pObject is Player)
@@ -467,7 +472,7 @@ public void Update(GameTime gameTime, ref GameStates gameState)
pObject.Update(gameTime);
// Update zoom based on players velocity
- pObject.FixForBounds((int)Size.X, (int)Size.Y);
+ pObject.FixForBounds((int)Size.X, (int)Size.Y, isCameraFixed);
UpdateCollisionMatrix(pObject, oldPos);
// handle collision right after you move
@@ -982,11 +987,13 @@ private AnimatedSprite GetAnimation(string name)
return newAnimation;
}
- public static Level MainMenuLevel(string filepath, IControlScheme controls, Viewport viewport)
+ public static Level MainMenuLevel(string filepath, IControlScheme controls, Viewport viewport, Rectangle region)
{
Level main = new Level(filepath,controls,viewport);
main.isCameraFixed = true;
main.shouldAnimate = false;
+ main.Size = new Vector2(region.Width*33/32, region.Height*7/8);
+ main.mStartingPoint = new Vector2(region.Width/2, region.Height/8);
return main;
}
}
View
16 WindowsGame1/Menu Code/MainMenu.cs
@@ -146,5 +146,21 @@ public Rectangle GetRegion(MenuChoices choice, Texture2D texture)
viewport.TitleSafeArea.Center.Y + (int)(mTitle.Height * mSize[1]) / 2 - ((int)(texture.Height * mSize[1]) / 2), (int)(texture.Width * mSize[0]), (int)(texture.Height * mSize[1]));
return new Rectangle();
}
+
+ /// <summary>
+ /// Gets the rectangle between the menu options
+ /// </summary>
+ /// <returns>Rectangle between menu choices</returns>
+ public Rectangle GetInnerRegion()
+ {
+ Rectangle topRectangle = GetRegion(MenuChoices.Exit, mSelected[MenuChoices.Exit]);
+ Rectangle leftRectangle = GetRegion(MenuChoices.Credits, mSelected[MenuChoices.Credits]);
+ Rectangle rightRectangle = GetRegion(MenuChoices.Options, mSelected[MenuChoices.Options]);
+ Rectangle bottomRectangle = GetRegion(MenuChoices.StartGame, mSelected[MenuChoices.StartGame]);
+
+ Rectangle region = new Rectangle(leftRectangle.Left, topRectangle.Top,
+ rightRectangle.Right - leftRectangle.Left,bottomRectangle.Bottom - topRectangle.Top);
+ return region;
+ }
}
}

0 comments on commit 71e6fcb

Please sign in to comment.
Something went wrong with that request. Please try again.