public InGameLevel(Player player1, Game game) { this._inGameService = (InGameManager)(game.Services.GetService(typeof(InGameManager))); this.spriteService = (IManageSprites)(game.Services.GetService(typeof(IManageSprites))); this._collisionService = (IManageCollision)(game.Services.GetService(typeof(IManageCollision))); _player1 = player1; }
public FightingLevel(Player player1, Game game) : base(player1, game) { //Laster inn bakgrunnen og og healthbars _background = new StaticSprite("ground", new Rectangle(0, 0, 1245, 700)); spriteService.LoadDrawable(_background); spriteService.LoadDrawable(new StaticSprite("healthBar")); spriteService.LoadDrawable(new StaticSprite("healthContainer")); }
public ChooseDirectionLevel(Player player1, Game game) : base(player1, game) { //bakgrunnsbildet _background = new StaticSprite("chooseLevelGround", new Rectangle(0, 0, (int)spriteService.GameWindowSize.X, (int)spriteService.GameWindowSize.Y)); spriteService.LoadDrawable(_background); //skiltet _sign = new StaticSprite("sign", new Rectangle(650, 200, 206, 173), 200 + 140); spriteService.LoadDrawable(_sign); }
public OracleNpc(String artName, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth, Player player, InGameLevel inGameLevel) : base(artName, destinationRectangle, sourceRectangle, color, rotation, origin, effects, layerDepth, player, inGameLevel) { _talkingRangeBox.Y -= 20; npcName = "Oracle"; dialogController = new DialogControl((NeutralNpc)this); InitialText(); }
public TownLevel(Player player1, Game game) : base(player1, game) { _background = new StaticSprite("ground", new Rectangle(0, 0, (int)spriteService.GameWindowSize.X, (int)spriteService.GameWindowSize.Y)); spriteService.LoadDrawable(_background); _shopkeeper = new MerchantNpc("shopkeeper", new Rectangle(400, 300, 118, 219), _player1, this); spriteService.LoadDrawable(_shopkeeper); _oracle = new OracleNpc("oracle", new Rectangle(900, 200, 148, 174), _player1, this); spriteService.LoadDrawable(_oracle); }
public MiningLevel(Player player1, Game game) : base(player1, game) { //Legger til en bakgrunn _background = new StaticSprite("ground", new Rectangle(0, 0, (int)spriteService.GameWindowSize.X, (int)spriteService.GameWindowSize.Y)); spriteService.LoadDrawable(_background); //Laster inn "stoneHit" som Texture2d spriteService.LoadDrawable(new StaticSprite("stonehit")); GoldStones = 3; }
private int[] _yPosArray; //En liste over posisjoner som fienden kan stelle seg ved #endregion Fields #region Constructors public AnimatedEnemy(Rectangle destinationRectangle, float layerDepth, float scale, Player player1, Game game) : base(destinationRectangle, layerDepth, scale, game) { _yPosArray = new int[] { 0, -150, -100, 0, 100, 150 }; _player1 = player1; _lastAllowedPosition = _destinationRectangle; //Legger til alle navn på animasjoner som fienden har, brukes for å laste inn riktige animasjoner i AnimatedSprite. animationList.Add("attack1"); animationList.Add("attack2"); animationList.Add("walk"); animationList.Add("run"); animationList.Add("taunt"); }
public NeutralNpc(String artName, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth, Player player, InGameLevel inGameLevel) : base(artName, destinationRectangle, sourceRectangle, color, rotation, origin, effects, layerDepth) { this.inGameLevel = inGameLevel; inConversation = false; _player1 = player; _talkingRangeBox = new Rectangle(destinationRectangle.Left - _talkingRangeBoxOffset, destinationRectangle.Bottom - _talkingRangeBoxHeight, destinationRectangle.Width + _talkingRangeBoxOffset * 2, _talkingRangeBoxHeight); inGameLevel.spriteService.LoadDrawable(new StaticSprite("box")); }
public Stone(String artName, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth, bool hasGold, Game game, Player player1) : base(artName, destinationRectangle, sourceRectangle, color, rotation, origin, effects, layerDepth) { _player1 = player1; stoneHitArt = new AnimatedStaticSprite("stonehit", new Rectangle(_destinationRectangle.X - 40, _destinationRectangle.Y - ((99-_destinationRectangle.Height)/2), 180, 99), Vector2.Zero, 4, 50, true); stoneHitArt.IsPlaying = false; endurance = 8; _footBox = new Rectangle(destinationRectangle.X, destinationRectangle.Bottom - 20, destinationRectangle.Width, 20); setLayerDepth(_footBox.Bottom); _hasGold = hasGold; _audioManager = (IManageAudio)game.Services.GetService(typeof(IManageAudio)); Directory = "stone"; }
public BlobEnemy(Rectangle destinationRectangle, float layerDepth, float scale, Player player1, Game game) : base(destinationRectangle, layerDepth, scale, player1, game) { //Setter diverse variabler som må settes fra denne klassen Directory = @"blob"; setSpeed(4); destinationRectangle.Width = (int)(destinationRectangle.Width * scale); destinationRectangle.Height = (int)(destinationRectangle.Height * scale); footBoxXOffset = (int)(20 * scale); footBoxYOffset = (int)(30 * scale); footBoxWidth = (int)(destinationRectangle.Width + (40 * scale)); footBoxHeight = (int)(40 * scale + 10); //Regner ut og setter footbox/hitboxen til ulven _footBox = new Rectangle(destinationRectangle.X - footBoxWidth / 2 + footBoxXOffset, destinationRectangle.Y + footBoxYOffset, footBoxWidth, footBoxHeight); //Setter vanskelighetsgraden, sender ved combatLevel til spiller, grunn-hitpoints og grunn-skade setDifficulty(player1.combatLevel, 80, 10); setHpBar(); }
public OracleNpc(String artName, Rectangle destinationRectangle, Player player, InGameLevel inGameLevel) : this(artName, destinationRectangle, new Rectangle(0, 0, destinationRectangle.Width, destinationRectangle.Height), new Color(255, 255, 255, 255), 0, Vector2.Zero, SpriteEffects.None, destinationRectangle.Bottom, player, inGameLevel) { }
public BlobEnemy(Rectangle destinationRectangle, float scale, Player player1, Game game) : this(destinationRectangle, 0.6f, scale, player1, game) { }
public Stone(Rectangle destinationRectangle, int sourceYPos, int color, bool hasGold, Game game, Player player1) : this("stone", destinationRectangle, new Rectangle(0, sourceYPos, destinationRectangle.Width, destinationRectangle.Height), new Color(200, color + 30, color, 255), 0, Vector2.Zero, SpriteEffects.None, destinationRectangle.Bottom, hasGold, game, player1) { }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { //laster inn komponenter _spriteService = (IManageSprites)Game.Services.GetService(typeof(IManageSprites)); _stateService = (IManageStates)Game.Services.GetService(typeof(IManageStates)); _collisionService = (IManageCollision)Game.Services.GetService(typeof(IManageCollision)); _inputService = (IManageInput)Game.Services.GetService(typeof(IManageInput)); _audioService = (IManageAudio)Game.Services.GetService(typeof(IManageAudio)); //oppretter musikkkontrollerne _spriteService.LoadDrawable(new StaticSprite("musicOptions")); _spriteService.LoadDrawable(new StaticSprite("soundOptions")); musicToggle = new musicToggleButton("musicOptions", new Rectangle((int)_spriteService.GameWindowSize.X - 40, 0, 40, 40), new Rectangle(0, 0, 40, 40), Game); soundToggle = new SoundToggleButton("soundOptions", new Rectangle((int)_spriteService.GameWindowSize.X - 80, 0, 40, 40), new Rectangle(0, 0, 40, 40), Game); _persistentInGameUI.Add(musicToggle); _persistentInGameUI.Add(soundToggle); //oppretter Random rand = new Random(); //oppretter spilleren _player1 = new Player(new Rectangle(100, 100, 150, 330), 0.5f, Game); _spriteService.LoadDrawable(_player1); //oppretter spillbanene _chooseDirectionlevel = new ChooseDirectionLevel(_player1, Game); _fightingLevel = new FightingLevel(_player1, Game); _miningLevel = new MiningLevel(_player1, Game); _townLevel = new TownLevel(_player1, Game); //Selve spillet starter på denne banen ChangeInGameState("ChooseDirectionLevel", 100, 450); base.Initialize(); }