.White, 0f, Vector2.Zero, scale, SpriteEffects.None, layer);
if (Move.X gt; 0)//Якщо рухається вправо
spriteBatch.Draw (RightWalk, Position, sourceRect, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, layer); if (Move.X == 0 amp; amp; View.X gt; 0)//Дивиться вправо.Draw (RightWalk, Position, zeroRec, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, layer);
if (Move.X lt; 0)//Якщо рухається вліво
spriteBatch.Draw (LeftWalk, Position, sourceRect, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, layer); if (Move.X == 0 amp; amp; View.X lt; 0)//Дивиться влево.Draw (LeftWalk, Position, zeroRec, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, layer);
(Bullet b in listBullet)//Малюємо кулі
{b.DrawBullet (spriteBatch); }
}
void Shoot (List lt; Bullet gt; listBullet)
{
//Малюємо пулюnewBullet=new Bullet (content.Load lt; Texture2D gt; (@ Textures/fireball ), this);// Встановлюємо текстуруH
//Задаємо координати (View.X == 0 amp; amp; View.Y == 0) .Velocity=new Vector2 (0, 7) ;. Velocity=View * 7f; (View.X gt; 0)
{. Position.X=Position.X + Width; .Position.Y=Position.Y + Height/2;
} if (View.X lt; 0)
{. Position.X=Position.X; .Position.Y=Position.Y + Height/2;
} if (View.Y gt; 0 || View.X == View.Y)
{. Position.X=Position.X + Width/2; ; .Position.Y=Position.Y + Height;
} if (View.Y lt; 0)
{. Position.X=Position.X + Width/2; .Position.Y=Position.Y;
}
//Додаємо пульку.Add (newBullet);
}
moveBullet (List lt; Bullet gt; listBullet, Decor dekor, List lt; Actor gt; listActor)
{(Bullet b in listBullet)//Для кожної пульки
{
b.Position +=b.Velocity;// Напрямок та швидкість кулі
if (Vector2.Distance (b.Position, Position) gt; 400) .isAlive=false; (gamePhysics.contactBulletDekor (b, dekor)). isAlive=false; .contactBulletActor (b, listActor );
} (int i=0; i lt; listBullet.Count; i ++)
{(! listBullet [i] .isAlive amp; amp; listBullet [i] .isVisible)
{. RemoveAt (i); -;
}
}
}
void hunt (Actor a)
{
}
}
}
ДОДАТОК Б
Клас Game1
System;System.Collections.Generic;System.IO;System.Linq;Microsoft.Xna.Framework;Microsoft.Xna.Framework.Audio;Microsoft.Xna.Framework.Content;Microsoft.Xna.Framework.GamerServices;Microsoft.Xna.Framework.Graphics;Microsoft.Xna.Framework.Input;Microsoft.Xna.Framework.Media;
Game1
{
/// lt; summary gt;
/// This is the main type for your game
/// lt;/summary gt; class Game1: Microsoft.Xna.Framework.Game
{Menu menu;
Physics physics; ContentManager contentManager;
GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Rectangle _viewPortRectangle;// Межі ігрового поля
Physics gamePhysics=new Physics ();
Actor Hero;// Герой
Field [] level=new Field [5]; int currentLevel=1;
KeyboardState pastKey;// Відпускати кнопка
GameState gameState=GameState.Menu;
int [,] Layer;
Texture2D hp; Texture2D hp1;
Game1 ()
{= new GraphicsDeviceManager (this) ;. RootDirectory= Content raquo ;;. PreferredBackBufferWidth=1080;// Ширина екрана.PreferredBackBufferHeight=640;// Висота екрана
//graphics.IsFullScreen=true;
}
/// lt; summary gt;
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well. <...