This is the main type for your game
Inheritance: Game
Esempio n. 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Esempio n. 2
0
 public Screen(Game1 g, String bg, String f)
 {
     background = g.Content.Load<Texture2D>(bg);
     font = g.Content.Load<SpriteFont>(f);
     selection = 0;
     numOfLinks = 0;
 }
Esempio n. 3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main()
 {
     using (var game = new Game1())
     {
         game.Run();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     formMain form = new formMain();
               form.Show();
               Game1 game = new Game1(form.getDrawSurface());
               game.Run();
 }
Esempio n. 5
0
 //contructor
 public Piece(Game1 game, int x, int y)
 {
     this.game = game;
     this.x = x;
     this.y = y;
     this.LoadImage();
 }
Esempio n. 6
0
 public Form1(Game1 mygame)
 {
     InitializeComponent();
     game = mygame;
     graphics = this.CreateGraphics();
     greenpen = new Pen(System.Drawing.Color.Green, 1);
 }
Esempio n. 7
0
        public Sheep(Game1 game, float x, float y)
            : base(game)
        {
            // Add to the sheep list
            sheep[sheepListCount] = this;
            index = sheepListCount;
            sheepListCount++;

            stateWeights = new int[,] { { 4, IdleState }, { 10, MOVE }, { 10, MOVE_SHEEP }, { 7, TURN }, { 7, FLOCK } };
            currentState = IdleState;
            base.x = x;
            base.y = y;
            this.DrawOrder = 1000;
            Random random = new Random((int)x);
            game.Components.Add(this);
            xVel = (float)random.Next(0, 5);
            random = new Random((int)y);
            yVel = (float)random.Next(0, 5);

            for (int i = 0; i < stateWeights.GetLength(0); i++)
            {
                totalWeights += stateWeights[i, 0];
            }
            alive = true;
            alert = false;
            done = true;

            this.map = map;

            lastUpdateTime = System.Environment.TickCount;
            random = new Random();
            double randomDirection = random.NextDouble() * 4;// get a random number between 1 and 4

            direction = (int)randomDirection;
        }
Esempio n. 8
0
 public Healthbar(Game1 game)
     : base(game)
 {
     // Choose a high number, so we will draw on top of other components.
     DrawOrder = 1000;
     textureGreen = game.textureGreen;
     textureRed = game.textureRed;
 }
Esempio n. 9
0
 public XsScGroup(Game1 g)
     : base(g)
 {
     translation = Matrix.CreateTranslation(new Vector3(0, 0, 0));
     rotation = Matrix.CreateRotationX(0) *
                Matrix.CreateRotationY(0) *
                Matrix.CreateRotationZ(0);
     scale = Matrix.CreateScale(1);
     recalculateWorldMatrix();
 }
Esempio n. 10
0
 public Vision(Game1 game, DrawableSprite parent)
     : base(game)
 {
     // TODO: Construct any child components here
     this.game = game;
     this.parent = parent;
     //this.dirLR = DIR_NONE;
     //this.dirUD = DIR_NONE;
     this.game.Components.Add(this);
 }
Esempio n. 11
0
        public ScriptHandler(Maps newmap, Player newplayer, Itemhandler newitems, Game1 newgame = null)
        {
            activescript = new Script("null");
            map = newmap;
            player = newplayer;
            items = newitems;
            game = newgame;

            IFstack = new List<bool>();
        }
Esempio n. 12
0
        public Game1()
        {
            _instance = this;

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = Defaults.window_size_x;
            graphics.PreferredBackBufferHeight = Defaults.window_size_y;
            Content.RootDirectory = "Content";

            _elements = new LinkedList<AElement>();
        }
Esempio n. 13
0
 public Game1()
 {
     sm_game = this;
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferredBackBufferWidth = 1024;
     graphics.PreferredBackBufferHeight = 960;
     graphics.ApplyChanges();
     Content.RootDirectory = "Content";
     audioSys = new AudioSys();
     gameData = new GameData();
 }
Esempio n. 14
0
 public HealthBar(Game1 game, int x, int y)
     : base(game)
 {
     // TODO: Construct any child components here
     this.game = game;
     this.x = x;
     this.y = y;
     DrawOrder = 2000;
     this.hp = 1.0f;
     this.game.Components.Add(this);
 }
Esempio n. 15
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Thread game = new Thread(() =>
            {
                game1 = new Game1();
                game1.Run();
            });

            game.Start();

            RemakeWindow();
        }
Esempio n. 16
0
 public Werewolf(Game1 game, int width, int height)
     : base(game)
 {
     // TODO: Construct any child components here
     DrawOrder = 1000; // Always draw this last.
     screenWidth = width*Map.TILE_SIZE;
     screenHeight = height*Map.TILE_SIZE;
     game.Components.Add(this);
     skin = new PlayerSkin(game, this);
     this.x = 1000;
     this.y = 1000;
     this.game = game;
     this.damp = 10.0f;
 }
Esempio n. 17
0
        public Ball(Game1 game, int seed)
            : base(game)
        {
            destRect = new Rectangle(0,0,36,36);
            x = 1500;
            y = 1500;

            game.Components.Add(this);
            Random random = new Random(seed);
            x = (float)random.Next(0,3000);
               random = new Random((int)(seed*3.2));
            y = (float)random.Next(0, 3000);
            damp = 4.0f;
            applyForce = true;
            slope.range = 6;
        }
Esempio n. 18
0
 public Hunter(Game1 game, float x, float y)
     : base(game)
 {
     stateWeights = new int[,] { { 4, IdleState }, { 10, MOVE }, { 10, MOVE_SHEEP }, { 7, TURN } };
     currentState = IdleState;
     base.x =x;
     base.y = y;
     this.DrawOrder = 1000;
     x += 500;
     y += 500;
     random = new Random((int)x);
     game.Components.Add(this);
     xVel = (float)random.Next(0,5);
     random = new Random((int)y);
     yVel = (float)random.Next(0, 5);
     for (int i = 0; i < stateWeights.GetLength(0); i++)
     {
         totalWeights += stateWeights[i,0];
     }
 }
Esempio n. 19
0
 public Map(Game1 game, int width, int height)
     : base(game)
 {
     // TODO: Construct any child components here
     this.game = game;
     this.width = width;
     this.height = height;
     this.game.Components.Add(this);
        /* Hunter hunter = new Hunter(game,200f,200f);
     hunter = new Hunter(game, 200f, 200f);
     hunter = new Hunter(game, 250f, 200f);
     hunter = new Hunter(game, 3500f, 350f);
     hunter = new Hunter(game, 400f, 200f);
     hunter = new Hunter(game, 500f, 450f);
     hunter = new Hunter(game, 5500f, 780f);
     hunter = new Hunter(game, 200f, 4500f);
     hunter = new Hunter(game, 350f, 200f);
     hunter = new Hunter(game, 100f, 200f);
     hunter = new Hunter(game, 200f, 240f);*/
     //hunter = new Hunter(game, 200f, 200f);
     Sheep sheep = new Sheep(game, 300, 300);
        sheep = new Sheep(game, 300, 300);
     sheep = new Sheep(game, 120, 300);
     sheep = new Sheep(game, 300, 1300);
      sheep = new Sheep(game, 20, 300);
      sheep = new Sheep(game, 50, 1500);
     sheep = new Sheep(game, 400, 300);
     sheep = new Sheep(game, 2000, 50);
      sheep = new Sheep(game, 100, 300);
      for (var i = 0; i < 30; i++)
      {
          Random randomy = new Random(i * 33);
          Random randomx = new Random(i * 51);
          sheep = new Sheep(game, randomx.Next(0,getWidth()), randomy.Next(0, getHeight()));
      }
 }
Esempio n. 20
0
        //We will need references to the paddles for collision detection, and
        //our Game1 contains these references, our ball should have the
        //reference to the Game1
        public Ball(Game1 g, String texture)
        {
            //set the game1 object
            game1 = g;

            //set the texture of the ball
            this.texture = game1.Content.Load<Texture2D>(texture);

            //we use a random object when randomly setting the balls direction
            rand = new Random();

            //the ball should start near at the center of the screen
            //use a size of 20x20
            ball = new Rectangle(
                game1.GraphicsDevice.Viewport.Bounds.Width / 2 - ball.Width / 2,
                game1.GraphicsDevice.Viewport.Bounds.Height / 2 - ball.Height / 2,
                20,
                20);

            reset();

            //Initialize the score
            font = game1.Content.Load<SpriteFont>(@"ScoreFont");
        }
Esempio n. 21
0
 public XsSceneElement(Game1 game)
 {
     this.game = game;
     el = new List<XsSceneElement>();
 }
Esempio n. 22
0
 public SlopedComponent(Game1 game)
     : base(game)
 {
     slope = new Slope();
 }
Esempio n. 23
0
 //constructor
 public Rook(Game1 game, int x, int y)
     : base(game, x, y)
 {
 }
Esempio n. 24
0
 public XsScRectTextured(Game1 g)
     : base(g)
 {
 }
Esempio n. 25
0
 public Car(Game1 game, int id, string nameModel, Vector3 startPosition)
     : base(game, id, nameModel)
 {
     this.iniPhysx(startPosition);
 }
Esempio n. 26
0
 public Player(Game1 game)
 {
     mGame = game;
     mAnimationset = AnimationSetManager.Instance.Get("tuzi");
     mAnimation = mAnimationset.Animations[0];
 }
Esempio n. 27
0
 public Queen(Game1 game, int x, int y)
     : base(game, x, y)
 {
 }
Esempio n. 28
0
 public XsCamera(Game1 game)
     : base(game)
 {
 }
Esempio n. 29
0
 // Scene contains more scene elements
 public XsScene(Game1 game1)
     : base(game1)
 {
     parent = this;
 }
Esempio n. 30
0
 public XsScModel(Game1 g)
     : base(g)
 {
 }