Conquerator 1.0 Released

Hive
iSheep
Orblast
Specimen

You should now have something similar to this, from here select the top section (above the black line) with the Magic Wand tool, and press the delete key. The top section should now change to grey and white checkered boxes, this represents the alpha layer.
Because we are going to be using this image as the image that will deform the level we need to specify that the iniside of the level is white (we will replace this in code with alpha pixels) and the outside of te ellipse will be transparent / alpha like this. Then save this as a PNG file as well and call it "deform". Or you can download my copy here.
Finally lets create a nice sky background, create a new image 800x600, then select a nice blue colour for your Primary color and make leave your secondary colour white. Then simply select from the Effects menu "Effects -> Render -> Clouds" and click the OK button. Save this image as sky.jpg (Note! We don't need to save this as a PNG file as the sky image contains no alpha layer, so by using a JPG format we can save a little on disk space)SpriteBatch spriteBatch;We need to declare the sky, level, and deform sprites:
private Texture2D textureSky;Then in the LoadContent class lets replace the // TODO comment by loading our content:
private Texture2D textureLevel;
private Texture2D textureDeform;
textureSky = Content.Load<Texture2D>("sky");We are already ready to start on the draw class, so lets replace the // TODO comment in the Draw function with the following:
textureLevel = Content.Load<Texture2D>("level");
textureDeform = Content.Load<Texture2D>("deform");
spriteBatch.Begin();Right, already we are ready to build the game and see our level, it should look something like this:
spriteBatch.Draw(textureSky, new Vector2(0, 0), Color.White);
spriteBatch.Draw(textureLevel, new Vector2(0, 0), Color.White);
spriteBatch.Draw(textureDeform, new Vector2(100, 100), Color.White);
spriteBatch.End();

this.IsMouseVisible = true;Next we declare the Vector2 variable to store the mouse position (add this below the where we added the Texture2D declarations) and also declare the current mouse state:
private Vector2 mousePosition;Now we need to update the mousePosition, so lets create a new function do this for us:
private MouseState currentMouseState;
protected void UpdateMouse()We then replace the // TODO: comment line in the Update function with a call to the UpdateMouse function we just created.
{
currentMouseState = Mouse.GetState();
// This gets the mouse co-ordinates
// relative to the upper left of the game window
mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
}
UpdateMouse();And finally modify the draw call for the textureDeform sprite to use the mouse position:
spriteBatch.Draw(textureDeform, mousePosition, Color.White);Hit F5 and try it out.
private uint[] pixelDeformData;Then in the LoadContent function add the following after you load the textureDeform:
// Declare an array to hold the pixel dataRemember because we can deform the level an endless amount of times we need to load the pixel array each time you try deform the level, so lets do that in a separate function which we can call when the mouse is clicked.
pixelDeformData = new uint[textureDeform.Width * textureDeform.Height];
// Populate the array
textureDeform.GetData(pixelDeformData, 0, textureDeform.Width * textureDeform.Height);
protected void DeformLevel()Before we can test it we need to actually call the function by left clicking with the mouse.
{// Declare an array to hold the pixel data}
uint[] pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];
// Populate the array
textureLevel.GetData(pixelLevelData, 0, textureLevel.Width * textureLevel.Height);
for (int x = 0; x < textureDeform.Width; x++)
{for (int y = 0; y < textureDeform.Height; y++)}
{pixelLevelData[((int)mousePosition.X + x) + ((int)mousePosition.Y + y)}
* textureLevel.Width] = pixelDeformData[x + y * textureDeform.Width];
// Update the texture with the changes made above
textureLevel.SetData(pixelLevelData);
So all we have done now is updated the texture of the level with a copy of the deform level, now lets test the colour of the pixel in the deform array to see if its an alpha pixel, if it is then we don't need to update the level pixel colour, that will prevent the square alpha layer shown above around the deform sprite. We can do the same pixel test on the level array as well, this will then prevent the deform sprite from being drawn where ever the cloud is visible.
Now if you run the game it will look something like this when you click around, which is much closer to the desired effect:
You could apply the same principles to add to the level as well, for example you could paste the dead body of a player to the terrain or a tombstone where the player died.ScreenManager.AddScreen();to:
ScreenManager.AddScreen(new SearchScreen(networkSessionType));And thats it.
ScreenManager.AddScreen(new XboxLiveScreen());to pass in the session type, you will also need to add Microsoft.Xna.Framework.Net to the using statements :
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.PlayerMatch));And under case 2: lets add the following line:
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.SystemLink));You will also need to the LobbyScreen.cs file and modify this line and move it to above where we checking if the networkSession is null:
ScreenManager.AddScreen(new XboxLiveScreen();To the following (here we passing in the current network session type so that it goes back to the correct menu):
ScreenManager.AddScreen(new XboxLiveScreen(networkSession.SessionType));Ok, so if we had to run the following and tried to login to System Link (without signing into LIVE first) we would get this error:
ScreenManager.AddScreen(new SearchScreen());
HostHere is what I have so far:Joined Player
- Waiting for all players to click ready
- Ready to start game
- Click Ready
- Waiting for host to start game
Under XBox Live:So lets go ahead and add a new menu screen like we did before for the Multiplayer menu screen.
- Create XBox LIVE Session
- Join Xbox LIVE Session
IAsyncResult LIVEResult = null;In the OnSelectEntry function under case 0: add the following:
this.isEnabled = false;Feel free to change the parameters above (the 2 = local players and 8 = max network players) to whatever you want for your project. You will also want to let the player know that something has happend when the pressed the button to start the LIVE session... so lets change the menu text to the following:
LIVEResult = NetworkSession.BeginCreate(NetworkSessionType.PlayerMatch, 2, 8, new AsyncCallback(LoadLobbyScreen), null);
MenuEntries[0] = "Creating Session...";Next we need to add the Callback function we used above called "LobbyLoadScreen"... add this to you XBoxLiveScreen class:
Clicking Multiplayer should now take you to a screen like this:
