Example #1
0
    public PacmanGame(Window gameWindow)
    {
        SplashKit.LoadMusic("siren", "siren.mp3");
        SplashKit.LoadSoundEffect("theme", "theme.mp3");
        SplashKit.LoadSoundEffect("dead", "dead.mp3");
        SplashKit.LoadSoundEffect("eating", "eating.mp3");
        SplashKit.LoadSoundEffect("eaten", "eaten.mp3");
        SplashKit.LoadSoundEffect("vulnerable", "vulnerable.mp3");

        _StartTimer  = SplashKit.CreateTimer("startTimer");
        _GameWindow  = gameWindow;                 // reference to the passed in window
        _Gameboard   = new Gameboard(_GameWindow); // instantiate gameboard object
        _GameStopped = true;
        _GameOver    = false;
        SplashKit.LoadFont("emulogic", "emulogic.ttf");
        _Pacman        = new Pacman(_GameWindow, _Gameboard, "pacman", "pacman", 162, 336, new int[] { 3, 10, 30 }); // instantiate player and save to field
        _Pacman._Lives = LIVES;                                                                                      // set lives to begin game
        // instantiate ghosts
        _Blinky = new Ghost(_GameWindow, _Gameboard, "blinky", "character", 162, 234, new int[] { 3, 6, 18 });       // instantiate blinky
        _Inky   = new Ghost(_GameWindow, _Gameboard, "inky", "character", 138, 234, new int[] { 3, 6, 18 });         // instantiate inky
        _Pinky  = new Ghost(_GameWindow, _Gameboard, "pinky", "character", 162, 234, new int[] { 3, 6, 18 });        // instantiate pinky
        _Clyde  = new Ghost(_GameWindow, _Gameboard, "clyde", "character", 186, 234, new int[] { 3, 6, 18 });        // instantiate clyde
        _Ghosts.Add(_Blinky);
        _Ghosts.Add(_Pinky);
        _Ghosts.Add(_Inky);
        _Ghosts.Add(_Clyde);
    }
Example #2
0
 public Game(Window gameWindow)
 {
     FillBagOfPieces();
     _CurrentShape    = ChooseNewShape();
     _CollisionTester = _CurrentShape.Clone();
     gameTimer        = SplashKit.CreateTimer("gameTicks");
     gameTimer.Start();
     gameTimer.Pause();
 }
Example #3
0
 public Ghost(Window gameWindow, Gameboard gameBoard, string charName, string charScript, int startX, int startY, int[] animSize) : base(gameWindow, gameBoard, charName, charScript, startX, startY, animSize)
 {
     _Animation.Assign("MoveUp");                          // start anim frame
     _Name           = charName;                           // character name
     _WaitDirUp      = false;                              // flag to pause ghost
     _Waiting        = false;                              // centre box waiting
     _Timer          = SplashKit.CreateTimer("timer");     // timer
     _VulnTimer      = SplashKit.CreateTimer("vulntimer"); // vulerability timer
     _Vulnerable     = false;                              // flag for vulnerability
     _CurrGhostPivot = PointRtn(0, 0);                     // intialise curr pivot to empty, as character hasn't passed a pivot yet
     _CurrTarget     = RandomPivot();                      // target from ghost pivot list
     if (_Name == "blinky")                                // blinky is annoying..
     {
         _Position.Y = _StartPosition.Y - 42;
     }
 }
Example #4
0
 private GameTimer()
 {
     SplashKit.CreateTimer("Timer");
     SplashKit.StartTimer("Timer");
 }