This is the main type for your game
Inheritance: Microsoft.Xna.Framework.Game
Exemple #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Main game = new Main())
     {
         game.Run();
     }
 }
Exemple #2
0
 //********************************************
 // Constructors
 //********************************************
 public InputManager(Main game)
 {
     z_game = game;
     z_prevKeyState = z_curKeyState = new KeyboardState();
     z_prevPadState = z_curPadState = new GamePadState();
     SetDefaultControls();
 }
Exemple #3
0
        //********************************************
        // Constructors
        //********************************************
        public Menu(Main game, string tag)
        {
            z_game = game;
            z_objects = new List<MenuObject>();
            Tag = tag;

            z_active = false;
        }
Exemple #4
0
 //********************************************
 // Public Properties
 //********************************************
 //********************************************
 // Constructors
 //********************************************
 public StageManager(Main game)
 {
     z_game = game;
     z_stage = new Stage();
     z_isUpdating = false;
     z_adds = new Stack<GameObject>(5);
     z_removes = new Stack<GameObject>(10);
 }
Exemple #5
0
 public StarField(Main game)
     : base(game, game.Content.Load<Texture2D>("Textures\\Starscape4"))
 {
     Layer = LayerConstants.BackgroundLayer;
     Width = game.WorldRect.Width;
     Height = game.WorldRect.Height;
     Speed = 25.0f/1000;
     Direction = VectorHelper.AngleToVector(MathHelper.ToRadians(90));
     Position = Vector2.Zero;
     z_font = game.Content.Load<SpriteFont>("Fonts\\LivesFont");
 }
Exemple #6
0
        //********************************************
        // Constructors
        //********************************************
        public AudioManager(Main game)
        {
            z_game = game;
            MediaPlayer.IsRepeating = true;
            z_currentSong = SongList.None;

            z_volMusic = 1.0f;
            z_volSoundFX = 1.0f;
            MasterVolume = 1.0f;
            MusicOn = true;
            SoundFXOn = true;
            SoundOn = true;
        }
Exemple #7
0
 //**************************
 // Constructors
 //**************************
 public PlayerShip(Main game)
     : base(game, game.Content.Load<Texture2D>("Images\\ship1"))
 {
     z_typeID = PlayerShip.ObjectTypeID;
     Health = 100;
     Lives = 3;
     Score = 0;
     ShotsTaken = 0;
     Hits = 0;
     Position = new Vector2(640, 650);
     SpriteOrientation = 3f * MathHelper.PiOver2;
     Layer = LayerConstants.ObjectLayer;
     Direction = -Vector2.UnitY;
     DrawRotation = VectorHelper.VectorToAngle(Direction);
 }
Exemple #8
0
        public GameObject(Main game, Texture2D sprite)
        {
            z_typeID = GameObject.ObjectTypeID;
            z_game = game;
            z_spriteRects = new List<Rectangle>();
            // the spriteRect array will likely be maintained as a static variable by derived classes to save memory.
            Sprite = sprite; // this automatically sets all sprite related parameters, such as width, center, scale, etc

            z_animationDelay = 100;
            z_animationTimer = 0;
            z_position = Vector2.Zero;
            z_direction = Vector2.Zero;
            z_speed = 0.0f;
            z_removeMe = false;
            z_spriteColor = Color.White;
            z_spriteAlpha = 100.0f;
            z_visible = true;
            z_drawRotation = 0.0f;
            z_maxTurnRate = MathHelper.Pi / 3000f;
            z_children = new List<GameObject>();
        }
Exemple #9
0
 //********************************************
 // Public Properties
 //********************************************
 //********************************************
 // Constructors
 //********************************************
 public TitleMenu(Main game)
     : base(game, "Title")
 {
 }
 //********************************************
 // Constructors
 //********************************************
 public MissionManager(Main game)
 {
     z_game = game;
 }
Exemple #11
0
 // Create a new GameObject with the exact same values as the original
 // It copies the references for the sprite and sprite rect arrays,
 // but does not copy child lists. This MUST be implemented by classes
 // utilizing Pool<T>, as it is used to create the copies for the pool.
 public GameObject(GameObject obj)
 {
     z_typeID = GameObject.ObjectTypeID;
     z_game = obj.z_game;
     z_position = obj.z_position;
     z_direction = obj.z_direction;
     z_layer = obj.z_layer;
     z_speed = obj.z_speed;
     z_maxSpeed = obj.z_maxSpeed;
     z_acceleration = obj.z_acceleration;
     z_accelerateTo = obj.z_accelerateTo;
     z_sprite = obj.z_sprite;
     z_spriteRects = obj.z_spriteRects;
     z_firstFrameToDraw = obj.z_firstFrameToDraw;
     z_lastFrameToDraw = obj.z_lastFrameToDraw;
     z_currentFrame = obj.z_currentFrame;
     z_animationTimer = obj.z_animationTimer;
     z_animationDelay = obj.z_animationDelay;
     z_visible = obj.z_visible;
     z_width = obj.z_width;
     z_height = obj.z_height;
     z_scaleX = obj.z_scaleX;
     z_scaleY = obj.z_scaleY;
     z_drawRotation = obj.z_drawRotation;
     z_spriteOrientation = obj.z_spriteOrientation;
     z_maxTurnRate = obj.z_maxTurnRate;
     z_spriteWidth = obj.z_spriteWidth;
     z_spriteHeight = obj.z_spriteHeight;
     z_spriteColor = obj.z_spriteColor;
     z_SpriteCenter = obj.z_SpriteCenter;
     z_removeMe = false;
     z_moveTo = obj.z_moveTo;
     z_spriteAlpha = obj.z_spriteAlpha;
     z_parent = null;
     z_children = new List<GameObject>();
 }
Exemple #12
0
 //********************************************
 // Public Properties
 //********************************************
 //********************************************
 // Constructors
 //********************************************
 public MainMenu(Main game)
     : base(game, "Main")
 {
 }
Exemple #13
0
 //********************************************
 // Public Properties
 //********************************************
 //********************************************
 // Constructors
 //********************************************
 public PlayerManager(Main game)
 {
     z_game = game;
 }
Exemple #14
0
 public Enemy(Main game, Texture2D sprite)
     : base(game, sprite)
 {
 }