Example #1
0
 public AppFramework()
 {
     map = new Map();
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0));
 }
Example #2
0
        public Duck(int player, Vector2 position, Map map)
        {
            this.player = player;
            body = BodyFactory.Instance.CreateCircleBody(AppFramework.PhysicsSimulator, 14, 1);
            geom = GeomFactory.Instance.CreateCircleGeom(AppFramework.PhysicsSimulator, body, 14, 20);
            geom.Tag = this;
            geom.OnCollision += new Geom.CollisionEventHandler(OnCollision);
            geom.CollisionGroup = 1 + player;
            frame = 0;
            this.Position = position;
            this.startPosition = position;
            this.map = map;
            sawAnotherDuck = false;
            state = State.Playing;

            replayData = new ReplayData[10000];

            visible = false;
        }
Example #3
0
        public void LoadMap(Map newMap)
        {
            width = newMap.width;
            height = newMap.height;

            startPositions = new Dictionary<int, Tile>();
            map = new Tile[width * height];
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    map[y * width + x] = new Tile(newMap.map[y * width + x].type, newMap.map[y * width + x].position, newMap.map[y * width + x].size, newMap.map[y * width + x].player, x, y);
                    if (map[y * width + x].type == TileType.Start)
                    {
                        if (!startPositions.ContainsKey(map[y * width + x].player))
                        {
                            startPositions[map[y * width + x].player] = map[y * width + x];
                        }
                    }
                    if (map[y * width + x].type == TileType.End)
                    {
                        if (!endPositions.ContainsKey(map[y * width + x].player))
                        {
                            endPositions[map[y * width + x].player] = map[y * width + x];
                        }
                    }
                    map[y * width + x].InitialisePhysics();
                }
            }
        }
Example #4
0
 public void NewGameReset(Vector2 position, Map map)
 {
     this.Position = position;
     this.startPosition = position;
     this.map = map;
     sawAnotherDuck = false;
     state = State.Playing;
     lastFrame = 0;
     visible = false;
     Reset();
 }
Example #5
0
 /// <summary>
 /// 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.
 /// </summary>
 protected override void Initialize()
 {
     map = new Map();
     camera = new Camera(GraphicsDevice);
     base.Initialize();
 }