예제 #1
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);
    }
예제 #2
0
    static void Main()
    {
        JewelJam game = new JewelJam();

        game.Run();
    }