Le mode multijoueur
CHAPITRE 11
243
protected override void Initialize()
{
// …
herosBOnA = new Tile(0, 0, 5);
herosAOnB = new Tile(0, 0, 5);
}
protected override void LoadContent()
{
// …
herosAOnB.LoadContent(Content, "tile");
herosBOnA.LoadContent(Content, "tile");
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
GraphicsDevice.Viewport = viewportA;
spriteBatch.Begin();
map.Draw(spriteBatch, cameraA);
herosA.Draw(spriteBatch);
if (cameraA.Contains(herosB.X, herosB.Y))
{
herosBOnA.Position = new Vector2((herosB.X - cameraA.X) * 32, (herosB.Y -
➥cameraA.Y) * 32);
herosBOnA.Draw(spriteBatch);
}
spriteBatch.End();
GraphicsDevice.Viewport = viewportB;
spriteBatch.Begin();
map.Draw(spriteBatch, cameraB);
herosB.Draw(spriteBatch);
if (cameraB.Contains(herosA.X, herosA.Y))
{
herosAOnB.Position = new Vector2((herosA.X - cameraB.X) * 32, (herosA.Y -
➥cameraB.Y) * 32);
herosAOnB.Draw(spriteBatch);
}
spriteBatch.End();
base.Draw(gameTime);
}
=Labat FM.book Page 243 Vendredi, 19. juin 2009 4:01 16
Précédent

- 264/366

Suivant