Пример #1
0
    protected override void LoadContent()
    {
        base.LoadContent();

        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        gameWorld.AddChild(background);

        // add a "playing field" parent object for the grid and the row selector
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = GridOffset;
        gameWorld.AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // set the world size to the width and height of the background sprite
        worldSize = new Point(background.Width, background.Height);

        // to let the new world size take effect, we need to set the FullScreen property again
        FullScreen = false;
    }
Пример #2
0
    public JewelJamGameWorld()
    {
        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        Size = new Point(background.Width, background.Height);
        AddChild(background);

        // add a "playing field" parent object for the grid and all related objects
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = new Vector2(85, 150);
        AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // reset some game parameters
        Reset();
    }
Пример #3
0
    public JewelJamGameWorld(JewelJam game)
    {
        // store a reference to the game
        this.game = game;

        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        Size = new Point(background.Width, background.Height);
        AddChild(background);

        // add a "playing field" parent object for the grid and all related objects
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = new Vector2(85, 150);
        AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // add a background sprite for the score object
        SpriteGameObject scoreFrame = new SpriteGameObject("spr_scoreframe");

        scoreFrame.LocalPosition = new Vector2(20, 20);
        AddChild(scoreFrame);

        // add the object that displays the score
        ScoreGameObject scoreObject = new ScoreGameObject();

        scoreObject.LocalPosition = new Vector2(270, 30);
        AddChild(scoreObject);

        // add the moving jewel cart
        jewelCart = new JewelCart(new Vector2(410, 230));
        AddChild(jewelCart);

        // add the help button
        helpButton = new SpriteGameObject("spr_button_help");
        helpButton.LocalPosition = new Vector2(1270, 20);
        AddChild(helpButton);

        // add combo images with visibility timers attached to them
        timer_double = AddComboImageWithTimer("spr_double");
        timer_triple = AddComboImageWithTimer("spr_triple");

        // add the various overlays
        titleScreen    = AddOverlay("spr_title");
        gameOverScreen = AddOverlay("spr_gameover");
        helpScreen     = AddOverlay("spr_frame_help");

        // start at the title screen
        GoToState(GameState.TitleScreen);
    }
Пример #4
0
    public RowSelector(JewelGrid grid) : base("spr_selector_frame")
    {
        // store a reference to the grid
        this.grid = grid;

        // start at the top row
        selectedRow = 0;

        // choose the origin so that the sprite nicely wraps around a grid row
        origin = new Vector2(10, 10);
    }
Пример #5
0
    protected override void LoadContent()
    {
        base.LoadContent();

        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        gameWorld.AddChild(background);

        // add the grid
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize, GridOffset);

        gameWorld.AddChild(grid);

        // set the world size to the width and height of the background sprite
        worldSize = new Point(background.Width, background.Height);

        // to let the new world size take effect, we need to set the FullScreen property again
        FullScreen = false;
    }
Пример #6
0
    public JewelJamGameWorld()
    {
        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        worldSize = new Point(background.Width, background.Height);
        AddChild(background);

        // add a "playing field" parent object for the grid and all related objects
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = new Vector2(85, 150);
        AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // add a background sprite for the score object
        SpriteGameObject scoreFrame = new SpriteGameObject("spr_scoreframe");

        scoreFrame.LocalPosition = new Vector2(20, 20);
        AddChild(scoreFrame);

        // add the object that displays the score
        ScoreGameObject scoreObject = new ScoreGameObject();

        scoreObject.LocalPosition = new Vector2(270, 30);
        AddChild(scoreObject);

        // add the moving jewel cart
        jewelCart = new JewelCart(new Vector2(410, 230));
        AddChild(jewelCart);

        // reset some game parameters
        Reset();
    }