예제 #1
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup (_game, _keyboard, _message);

            var map = new TileMap("pictures/testlevel.png");
            m_house = new ObjectHouse(map);

            StarryBackground bg = new StarryBackground(map.Size);
            m_house.AddDrawable(bg);

            map.Create(m_house, _game);

            Magnum magnum = new Magnum(m_house);

            var hero = new Hero(_keyboard, m_house);
            hero.Position = new Vector2f(1f, 10f);
            hero.PlaceInWorld(map);
            m_house.AddDrawable(hero);
            m_house.AddUpdateable(hero);

            m_house.AddDrawable(magnum);
            m_house.AddUpdateable(magnum);

            var nHero = new NetworkHero(hero, "127.0.0.1", m_house);
            m_house.AddUpdateable(nHero);
            nHero.Connect();
        }
예제 #2
0
        public EditLocationsGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            exitButton = NewButton("Back", 0, Exit);

            label = NewLabel("Add:", 8);

            addBoxButton = NewButton("Box", 7, () => AddBox("box"+(locationCount++)));
            addPointButton = NewButton("Point", 6, () => AddPoint("point"+(locationCount++)));
            setEndLocationButton = NewButton("End zone", 10, () => AddBox(endzone));
            setStartLocationButton = NewButton("StartPoint", 11, () => AddPoint(startpoint));

            deleteButton = NewButton("Delete", 4, Delete);

            locationLabel = NewTextBox("Location label", "", 2);

            BoxDescription endzoneDesc = m_editor.Map.locationData.end;
            if (endzoneDesc != null && endzoneDesc.box != null) {
                makeBox(endzoneDesc.name, endzoneDesc.box);
            }
            PointDescription startpointDesc = m_editor.Map.locationData.start;
            if (startpointDesc != null &&  startpointDesc.point != null) {
                makePoint(startpointDesc.name, startpointDesc.point);
            }
            boxes2boxes.Clear();
            foreach (BoxDescription box in m_editor.Map.locationData.boxes) {
                var rBox = makeBox(box.name, box.box);
                boxes2boxes.Add(rBox, box);
            }
            points2points.Clear();
            foreach (PointDescription point in m_editor.Map.locationData.points) {
                var mPoint = makePoint(point.name, point.point);
                points2points.Add(mPoint, point);
            }
        }
예제 #3
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup (_game, _keyboard, _message);

            TileMap tilemap = new TileMap("pictures/empty_level.png");
            m_house = new ObjectHouse(tilemap);

            StarryBackground bg = new StarryBackground(tilemap.Size);
            m_house.AddDrawable(bg);

            Gangster gangsterNo1 = new Hero(m_keyboard, m_house);
            gangsterNo1.Position = new Vector2f(1f, 10f);
            gangsterNo1.PlaceInWorld(tilemap);
            m_house.AddDrawable(gangsterNo1);
            m_house.AddUpdateable(gangsterNo1);
            m_house.Add<IShootable>(gangsterNo1);
            m_game.SetCameraSubject(gangsterNo1);

            tilemap.Create(m_house, _game);

            Bitmap world_bmp = new Bitmap(tilemap.Width * Tile.Size, tilemap.Height * Tile.Size);
            for (int i = 0 ; i < world_bmp.Width ; i++) {
                for (int j = 0 ; j < world_bmp.Height; j++) {
                    world_bmp.SetPixel(i, j, Color.Green);
                }
            }
            GangsterTrail trail = new GangsterTrail(gangsterNo1, new Sprite(world_bmp));
            m_house.AddUpdateable(trail);
            m_house.AddDrawable(trail);
        }
예제 #4
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            Sprite title = new Sprite(new Bitmap("pictures/title.png"));
            title.Position = new Vector2f();
            title.Size = new Vector2f(Game.Width, Game.Height);

            m_house.AddDrawable(title);

            Text text = new Text("[Click] or Press [Space] to Start");
            text.CentreOn(new Vector2f(Game.Width/2, Game.Height/5));

            m_house.AddDrawable(text);

            fx_buffer
                = new Effect(
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.Width, Game.Height)) {
                CaptureLayer = Layer.Normal,
                Layer = Layer.FX,
                Priority = Priority.Front
            };
            fx_buffer.SetHUD(_game.Camera);
            fx_buffer.SetFading(0.5f, new Colour(0,0,0,1), new Colour(0,0,0,0));
            m_house.AddDrawable(fx_buffer);
            m_house.AddUpdateable(fx_buffer);
        }
예제 #5
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            m_house = new ObjectHouse();

            m_house.AddUpdateable(server);
        }
예제 #6
0
        public TextBox(UserInput input, Vector2f size, Camera camera)
            : base(input, size, camera)
        {
            Contents = new Text("");
            if (camera != null)
                Contents.SetHUD(camera);

            m_keyboard.KeyDown += AddLetter;
        }
예제 #7
0
파일: Hero.cs 프로젝트: joebain/MagnumHouse
        public Hero(UserInput _keys, ObjectHouse _house)
            : base(_house)
        {
            m_keys = _keys;
            m_magnum.invulnerable = true;
            Name = "hero";

            jumpSound = new Sound("sounds/jump.wav");
            landSound = new Sound("sounds/land.wav");
        }
예제 #8
0
        public StandardGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            tileClicks = new int[m_editor.Size.X, m_editor.Size.Y];

            spikyButton = NewChangeTileTypeButton("Spiky", 0, TileMap.SPIKY);
            blockButton = NewChangeTileTypeButton("Block", 1, TileMap.BLOCK);
            floorButton = NewChangeTileTypeButton("Floor", 2, TileMap.FLOOR);
            emptyButton = NewChangeTileTypeButton("Empty", 3, TileMap.EMPTY);

            playButton = NewButton("Play", 10, PlayLevel);

            fileButton = NewButton("File", 11, FileMode);
            locationsButton = NewButton("Locations", 12, LocationsMode);
        }
예제 #9
0
        public OkCancelGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            Button okButton = new Button(m_keyboard, "OK", m_game.Camera);
            okButton.Position = new Vector2f(okButton.Position.X, 1);
            okButton.Right();
            Console.WriteLine("ok button pos: {0}", okButton.Position);
            Button cancelButton = new Button(m_keyboard, "Cancel", m_game.Camera);
            cancelButton.Position = new Vector2f(cancelButton.Position.X, 3);
            cancelButton.Right();

            okButton.Pressed += Ok;
            cancelButton.Pressed += Cancel;

            items.Add(okButton);
            items.Add(cancelButton);
        }
예제 #10
0
        public FileGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            saveButton = NewButton("Save", 3, SaveLevel);
            loadButton = NewButton("Load", 4, LoadLevel);
            filenameBox = NewTextBox("Filename", m_editor.filename, 5);

            widthBox = new NumberBox(m_keyboard, new Vector2f(5,2), m_game.Camera);
            widthBox.Position = new Vector2f(1, 4);
            items.Add(widthBox);
            widthMinusButton = new Button(m_keyboard, "-", m_game.Camera);
            widthMinusButton.Position = new Vector2f(1 + widthBox.Size.X + 0.5f, 4);
            items.Add(widthMinusButton);
            widthPlusButton = new Button(m_keyboard, "+", m_game.Camera);
            widthPlusButton.Position = new Vector2f(6.5f + widthMinusButton.Size.X + 0.5f, 4);
            items.Add(widthPlusButton);

            backButton = NewButton("Back", 0, GoBack);
        }
예제 #11
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            TileMap tilemap = new TileMap("pictures/targetlevel.png");
            m_house = new ObjectHouse(tilemap);

            StarryBackground bg = new StarryBackground(tilemap.Size);
            m_house.AddDrawable(bg);

            gangsterNo1 = new Hero(m_keyboard, m_house);
            gangsterNo1.Position = new Vector2f(1f, 10f);
            gangsterNo1.PlaceInWorld(tilemap);
            m_house.AddDrawable(gangsterNo1);
            m_house.AddUpdateable(gangsterNo1);
            m_game.SetCameraSubject(gangsterNo1);

            tilemap.Create(m_house, _game);

            Text score = new Text("Left: 00");
            score.updateAction = (_d) => {
                score.Contents = "Left: " + m_house.GetAllDrawable<Target>().Count().ToString("00");
            };
            score.SetHUD(_game.Camera);
            score.TopRight();

            m_house.AddUpdateable(score);
            m_house.AddDrawable(score);

            Text time = new Text("Time: 00:00");
            time.SetHUD(_game.Camera);
            time.TopLeft();
            timePassed = 0;
            time.updateAction = (_d) => {
                timePassed += _d;
                time.Contents = "Time: " + timePassed.ToString("00.00").Replace(".",":");
            };

            m_house.AddUpdateable(time);
            m_house.AddDrawable(time);
        }
예제 #12
0
        public GuiItem(UserInput keyboard, Vector2f size, Camera camera)
        {
            m_keyboard = keyboard;
            m_keyboard.MouseDown += MouseClicked;

            Size = size;
            backgroundColour = new Colour(1,0.4f,0.4f,0.5f);
            foregroundColour = new Colour(1,1,1,1);
            Hidden = false;

            if (camera != null)
                SetHUD(camera);

            Layer = Layer.Normal;
            Priority = Priority.Front;

            displayList = Gl.glGenLists(1);
            Gl.glNewList(1, Gl.GL_COMPILE);
            ConstantDraw();
            Gl.glEndList();
        }
예제 #13
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            deathTimer = 0;
            startTimer = 0;
            winTimer = 0;

            m_tilemap = new TileMap(levelFile);

            m_size = new Vector2i(m_tilemap.Width, m_tilemap.Height);
            Bounds.Right = m_size.X;
            Bounds.Top = m_size.Y;
            m_house = new ObjectHouse(m_tilemap);

            StarryBackground bg = new StarryBackground(m_tilemap.Size);
            bg.Layer = Layer.Pixelly;
            m_house.AddDrawable(bg);

            gangsterNo1 = new Hero(m_keyboard, m_house);
            gangsterNo1.Position = m_tilemap.locationData.start.point;
            gangsterNo1.PlaceInWorld(m_tilemap);
            m_house.AddDrawable(gangsterNo1);
            m_house.AddUpdateable(gangsterNo1);
            m_house.Add<IShootable>(gangsterNo1);
            m_game.SetCameraSubject(gangsterNo1);

            m_tilemap.Create(m_house, _game);
            m_house.AddDrawable(m_tilemap);
            m_tilemap.Priority = Priority.Middle;

            endzone = m_tilemap.locationData.end.box;

            // fx

            // pixelly
            pixellyEffect
                = new Effect(
                    new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2),
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.Width, Game.Height)){
                CaptureLayer = Layer.Pixelly,
                Layer = Layer.FX,
                Priority = Priority.Back,
                Scaling = Sprite.ScaleType.Pixelly
            };
            pixellyEffect.SetHUD(_game.Camera);
            m_house.AddDrawable(pixellyEffect);
            m_house.AddUpdateable(pixellyEffect);
            m_house.Add<IGrabing>(pixellyEffect);

            // fading
            fadingEffect
                = new Effect(
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.Width, Game.Height)){
                CaptureLayer = Layer.Blurry | Layer.Pixelly | Layer.Normal | Layer.FX,
                Layer = Layer.Fade,
                Priority = Priority.Front
            };

            fadingEffect.SetHUD(_game.Camera);
            fadingEffect.SetFading(1f, new Colour(0,0,0,1), new Colour(0,0,0,0));
            fadingEffect.SetBackground(new Colour(0,0,0,1f));
            m_house.AddDrawable(fadingEffect);
            m_house.AddUpdateable(fadingEffect);
            m_house.Add<IGrabing>(fadingEffect);

            // messages
            welcome_message = new Text("Welcome to the Magnum House...");
            welcome_message.SetHUD(m_game.Camera);
            welcome_message.CentreOn(Game.Size.ToF()/2);
            welcome_message.Priority = Priority.Front;
            welcome_message.Layer = Layer.Normal;
            welcome_message.Transparency = 0f;
            m_house.AddDrawable(welcome_message);
        }
예제 #14
0
        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            deathTimer = 0;
            startTimer = 0;
            winTimer = 0;

            if (_message.Level != null) {
                m_tilemap = _message.Level;
            } else {
                m_tilemap = new TileMap(levelFile);
            }

            m_size = new Vector2i(m_tilemap.Width, m_tilemap.Height);
            Bounds.Right = m_size.X;
            Bounds.Top = m_size.Y;
            m_house = new ObjectHouse(m_tilemap);

            StarryBackground bg = new StarryBackground(m_tilemap.Size);
            m_house.AddDrawable(bg);

            gangsterNo1 = new Hero(m_keyboard, m_house);
            gangsterNo1.Position = new Vector2f(1f, 10f);
            gangsterNo1.PlaceInWorld(m_tilemap);
            m_house.AddDrawable(gangsterNo1);
            m_house.AddUpdateable(gangsterNo1);
            m_house.Add<IShootable>(gangsterNo1);
            m_game.SetCameraSubject(gangsterNo1);

            m_tilemap.Create(m_house, _game);
            m_house.AddDrawable(m_tilemap);

            //			Text score = new Text("Left: 00");
            //			score.updateAction = (_d) => {
            //				score.Contents = "Left: " + m_house.GetAllDrawable<Target>().Count().ToString("00");
            //			};
            //			score.SetHUD(_game.Camera);
            //			score.TopRight();
            //
            //			m_house.AddUpdateable(score);
            //			m_house.AddDrawable(score);
            //
            //			Score score_pic = new Score(gangsterNo1);
            //			score_pic.SetHUD(_game.Camera);
            //			score_pic.TopLeft();
            //
            //			m_house.AddUpdateable(score_pic);
            //			m_house.AddDrawable(score_pic);
            //
            //
            //			pixelly_fx_buffer
            //				= new ScreenSprite(
            //					new Vector2i(Game.SmallScreenWidth, Game.SmallScreenHeight),
            //					new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
            //				    new Vector2i(Game.Width, Game.Height)) {
            //				CaptureLayer = Layer.Pixelly,
            //				Layer = Layer.Normal,
            //				Scaling = Sprite.ScaleType.Pixelly,
            //				Feedback = 0.9f,
            //				Priority = Priority.Front
            //			};
            //			pixelly_fx_buffer.updateAction = () => {
            //				pixelly_fx_buffer.Position = -_game.Camera.LastOffset;
            //			};
            //
            //			m_house.AddDrawable(pixelly_fx_buffer);
            //			m_house.AddUpdateable(pixelly_fx_buffer);
            //			m_house.Add<IGrabing>(pixelly_fx_buffer);
            //
            //			blurry_fx_buffer
            //				= new ScreenSprite(
            //					new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2),
            //					new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
            //				    new Vector2i(Game.Width, Game.Height)) {
            //				CaptureLayer = Layer.Blurry,
            //				Layer = Layer.Normal,
            //				Scaling = Sprite.ScaleType.Blurry,
            //				Feedback = 0.9f,
            //				Priority = Priority.Back
            //			};
            //			blurry_fx_buffer.SetHUD(_game.Camera);
            //
            //			m_house.AddDrawable(blurry_fx_buffer);
            //			m_house.AddUpdateable(blurry_fx_buffer);
            //			m_house.Add<IGrabing>(blurry_fx_buffer);
            //
            death_fx_buffer
                = new Effect(
                    new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2),
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.Width, Game.Height)) {
                CaptureLayer = Layer.Normal,
                Layer = Layer.FX,
                Feedback = 1f,
                Priority = Priority.Front
            };
            death_fx_buffer.SetHUD(_game.Camera);
            death_fx_buffer.SetSpinning(15);
            death_fx_buffer.SetZooming(-0.2f);
            //
            //
            //
            //
            //			start_fx_buffer
            //				= new ScreenSprite(
            //				    new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2),
            //					new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
            //				    new Vector2i(Game.Width, Game.Height)) {
            //				CaptureLayer = Layer.Normal,
            //				Layer = Layer.FX,
            //				Priority = Priority.Front,
            //				Scaling = Sprite.ScaleType.Pixelly
            //			};
            //			start_fx_buffer.SetHUD(_game.Camera);
            //			start_fx_buffer.SetFading(1f, new float[]{0,0,0,1}, new float[]{0,0,0,0});
            //			start_fx_buffer.SetPixelling(new InverseLogAnimator(0.5f),
            //			                             new Vector2i(2, 2),
            //			                             start_fx_buffer.CaptureSize);
            //			start_fx_buffer.SetBackground(new float[]{0,0,0,1f});
            //			m_house.AddDrawable(start_fx_buffer);
            //			m_house.AddUpdateable(start_fx_buffer);
            //			m_house.Add<IGrabing>(start_fx_buffer);
            //
            //			welcome_message = new Text(_message.Message);
            //			welcome_message.SetHUD(m_game.Camera);
            //			welcome_message.CentreOn(Game.Size.ToF()/2);
            //			welcome_message.Priority = Priority.Front;
            //			welcome_message.Layer = Layer.FX;
            //			welcome_message.Transparency = 0f;
            //			m_house.AddDrawable(welcome_message);
        }
예제 #15
0
 public ResizeableBox(UserInput keyboard, Vector2f size, Camera camera)
     : base(keyboard, size, camera)
 {
     keyboard.MouseDown += MouseDownHandler;
     keyboard.MouseUp += MouseUpHandler;
 }
예제 #16
0
 public TickBox(UserInput input, Camera camera)
     : base(input, new Vector2f(1,1), camera)
 {
     Pressed += ToggleTicked;
 }
예제 #17
0
 public NumberBox(UserInput input, Vector2f size, Camera camera)
     : base(input, size, camera)
 {
 }
예제 #18
0
 private MoveablePoint(UserInput keyboard, Vector2f size, Camera camera)
     : base(keyboard, size, camera)
 {
     keyboard.MouseDown += MouseDownHandler;
     keyboard.MouseUp += MouseUpHandler;
 }
예제 #19
0
파일: Game.cs 프로젝트: joebain/MagnumHouse
 public Game()
 {
     m_keyboard = new UserInput(this);
 }
예제 #20
0
 public ColourTextBox(UserInput input, Vector2f size, Camera camera)
     : base(input, size, camera)
 {
 }
예제 #21
0
 public EditorCursor(UserInput keys, BoundingBox bounds)
 {
     m_keys = keys;
     m_bounds = bounds;
 }
예제 #22
0
 public MoveablePoint(UserInput keyboard, Camera camera)
     : this(keyboard, new Vector2f(2), camera)
 {
 }
예제 #23
0
 public virtual void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
 {
     m_message = _message;
     m_game = _game;
     m_keyboard = _keyboard;
 }
예제 #24
0
 public MoveableTextBox(UserInput input, Vector2f size, Camera camera)
     : base(input, size, camera)
 {
 }
예제 #25
0
 public GuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
 {
     m_game = _game;
     m_keyboard = _keyboard;
     m_editor = _editor;
 }