public GameBoard(Canvas canvas) { _canvas = canvas; Image Sky = GameObjectHelper.ReadImageFromFile(@"ms-appx:///Assets/2480x1200.png", 820, 470); GameObjectHelper.AddToGameBoard(Sky, -10, -10, canvas); _player = new PlayerObject((int)_canvas.Width / 2 - 21, (int)_canvas.Height - 40, _canvas); _player.IsAlive = true; _gameObjects.Add(_player); }
public BulletObject(Canvas canvas, int X, int Y) { TopLeftPosistionX = X; TopLeftPosistionY = Y; Width = 5; Height = 5; step = 3; IsAlive = true; Image = GameObjectHelper.ReadImageFromFile(@"ms-appx:///Assets/Bullet.png", Width, Height); GameObjectHelper.AddToGameBoard(Image, TopLeftPosistionY, TopLeftPosistionX, canvas); _canvas = canvas; }
public PlayerObject(int topLeftX, int topLeftY, Canvas canvas) { _canvas = canvas; TopLeftPosistionX = topLeftX; TopLeftPosistionY = topLeftY; Width = 43; Height = 9; step = 5; IsAlive = true; lives = 3; _direction = Direction.Stay; Image = GameObjectHelper.ReadImageFromFile(@"ms-appx:///Assets/arkanoid.png", Width, Height); GameObjectHelper.AddToGameBoard(Image, TopLeftPosistionY, TopLeftPosistionX, canvas); }
public ExplosionObject(int topLeftX, int topLeftY, Canvas canvas) { boom = new MediaPlayer { Source = Windows.Media.Core.MediaSource.CreateFromUri(new Uri(@"ms-appx:///Assets/boom.mp3", UriKind.RelativeOrAbsolute)) }; boom.Play(); TopLeftPosistionX = topLeftX; TopLeftPosistionY = topLeftY; Width = 20; Height = 20; IsAlive = true; Image = GameObjectHelper.ReadImageFromFile(@"ms-appx:///Assets/bullet.png", Width, Height); GameObjectHelper.AddToGameBoard(Image, TopLeftPosistionY, TopLeftPosistionX, canvas); _canvas = canvas; }
public MonsterObject(Canvas canvas, int level) { TopLeftPosistionX = random.Next(10, (int)canvas.Width); TopLeftPosistionY = random.Next(10, (int)canvas.Height / 2); Width = 20; Height = 20; IsAlive = true; step = 2; if (level > 7) { step += 1; } else { DropDown -= level; } var directionAsNumber = random.Next(1, 5); _direction = (Direction)directionAsNumber; Image = GameObjectHelper.ReadImageFromFile(@"ms-appx:///Assets/monster.png", Width, Height); GameObjectHelper.AddToGameBoard(Image, TopLeftPosistionY, TopLeftPosistionX, canvas); _canvas = canvas; }