public CollisionTests() { if (Application.ResourceAssembly == null) { Application.ResourceAssembly = typeof(MainWindow).Assembly; } _gameValues = new GameValues(); _gameValues.PlayCanvasHeight = 200; _gameValues.PlayCanvasWidth = 200; _gameValues.Movement = 2.5; _collisionDetector = new CollisionDetecter(_gameValues); _playgroundObjects = new List <IPlaygroundObject> { new MovableObject(ObjectType.Player, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 5, 5), new ImmovableObject(ObjectType.Obstacle, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 150, 5, true), new ImmovableObject(ObjectType.Coin, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 5, 105, true), new MovableObject(ObjectType.Enemy, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 150, 125), new StaticObject(ObjectType.EndPoint, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 5, 200), new StaticObject(ObjectType.Wall, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 150, 200) }; //extract player and enemy _player = (MovableObject)_playgroundObjects.First(x => x.ObjectType == ObjectType.Player); _enemy = (MovableObject)_playgroundObjects.First(x => x.ObjectType == ObjectType.Enemy); }
public ScoreTests() { if (Application.ResourceAssembly == null) { Application.ResourceAssembly = typeof(MainWindow).Assembly; } _gameValues = new GameValues(); _gameValues.PlayCanvasHeight = 600; _gameValues.PlayCanvasWidth = 784; _gameValues.HeigthWidthRatio = _gameValues.PlayCanvasHeight / _gameValues.PlayCanvasWidth; _gameValues.AmountOfXtiles = 20; _gameValues.AmountofYtiles = Math.Round(_gameValues.AmountOfXtiles * _gameValues.HeigthWidthRatio); _gameValues.TileWidth = _gameValues.PlayCanvasWidth / _gameValues.AmountOfXtiles; _gameValues.TileHeight = _gameValues.PlayCanvasHeight / _gameValues.AmountofYtiles; _gameValues.Movement = 2.5; _collisionDetecter = new CollisionDetecter(_gameValues); _playgroundObjects = new List <IPlaygroundObject> { new ImmovableObject(ObjectType.Coin, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 100, 100, 50, 5, true) }; _player = new MovableObject(ObjectType.Player, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 10, 10); _enemy = new MovableObject(ObjectType.Enemy, new Image { Source = new BitmapImage( new Uri("pack://application:,,,/Assets/Sprites/Pacman/pacman-right-halfopenjaw.png")) }, 50, 50, 10, 10); }