Example #1
0
        /// <summary>
        /// Constructs a new PacMan
        /// </summary>
        /// <param name="textureAsset">The path to the texture of this pacman</param>
        /// <param name="startCell">the starting cell of this  player</param>
        /// <param name="level">Reference to the level</param>
        /// <param name="controller">The controller for this player</param>
        /// <param name="startDirection">The start heading</param>
        /// <param name="speed">Defines how fast this player can move in cells per second</param>
        /// <param name="frameSize">Sets the framesize for the players texture</param>
        public PacMan(String textureAsset, Cell startCell, Level level, Controller
            controller, Direction startDirection, float speed,
                      Point frameSize)
            : base(textureAsset, startCell, level, startDirection, speed, controller, frameSize)
        {
            framePosition = new Point(0, 0);

            position = base.CurrentCell.Position;
            this.lives = 5;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="textureAsset">The path to the texture of this ghost</param>
        /// <param name="startCell">The starting cell for this ghost</param>
        /// <param name="level">The level</param>
        /// <param name="startDirection">The starting direction for this ghost</param>
        /// <param name="speed">The speed in cells per secon</param>
        /// <param name="frameSize">The framesize of a frame from the texture</param>
        /// <param name="color">The default color of this ghost</param>
        /// <param name="controller">A controller for this ghost</param>
        public Ghost(String textureAsset, Cell startCell, Level level, Direction startDirection, float speed, Point frameSize, Color color, Controller controller)
            : base(textureAsset, startCell, level, startDirection, speed, controller, frameSize)
        {
            framePosition = new Point(1, 1);
            position = startCell.Position;
            this.color = color;
            this.defaultColor = this.color;

            GhostBehaviour = EGhostBehaviour.Hunt;
        }
Example #3
0
        /// <summary>
        /// Constructor for a movable object
        /// </summary>
        /// <param name="textureAsset">The path to the texture that this object has to load</param>
        /// <param name="startCell">The starting cell of this MO</param>
        /// <param name="level">Reference to the level</param>
        /// <param name="startDirection">The direction this MO is facing at startup</param>
        /// <param name="cellsPerSecond">How many cells per second this MO should pass</param>
        /// <param name="controller">The controller for this object</param>
        /// <param name="frameSize">The size of the frame of this MO</param>
        public MovableObject(String textureAsset, Cell startCell, Level level, Direction startDirection, float cellsPerSecond, Controller controller, Point frameSize)
            : base(textureAsset)
        {
            currentDirection = startDirection;
            lastDirection = startDirection;

            currentCell = startCell;
            this.startCell = startCell;

            this._cellsPerSecond = CalculateSpeedFactor(cellsPerSecond);
            this._defaultCellsPerSecond = this._cellsPerSecond;
            this.level = level;

            this.frameSize = frameSize;

            speedVector = Vector2.Zero;
            lastSpeedVector = Vector2.Zero;

            soundEffects = new Dictionary<string, Cue>();

            this.PowerUpTimer = 0;
            this.controller = controller;
        }