public void AddFish(Fish fish) { Button button = new Button(new Vec2(0, 0), 300, 30, fish.GetFishName()); Sprite spr = new Sprite(fish.GetFishName() + "-icon.png"); spr.SetXY(journal.x + 690, journal.y + 150); spr.SetScaleXY(0.2f); spr.alpha = 0f; buttons.Add(button); fishSprites.Add(spr); AddChild(spr); switch (fish.GetFishType()) { case "Fresh water": freshFish.Add(fish); freshButtons.Add(button); freshSprites.Add(spr); break; case "Sea water": seaFish.Add(fish); seaButtons.Add(button); seaSprites.Add(spr); break; case "Deep water": deepFish.Add(fish); deepButtons.Add(button); deepSprites.Add(spr); break; } }
public Pause(NeonArkanoidGame game, Level.Level level) { _level = level; _game = game; x = -500; var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png"); background.SetOrigin(0, background.height / 2); background.y = game.height / 2; var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png"); header.SetOrigin(header.width / 2, header.height / 2); header.SetXY(background.width / 2, 200); _buttons = new[] { new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width / 2, 350, "Resume"), new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width / 2, 450, _level.GetLevelName()), new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width / 2, 550, "MainMenu") }; AddChild(background); AddChild(header); foreach (var button in _buttons) { AddChild(button); } _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav"); _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav"); }
public Pause(TimeGuardianGame game, LevelBase level) { _level = level; _game = game; x = -500; Sprite background = new Sprite(UtilStrings.SpritesPause + "background_pause.png"); background.SetOrigin(0,background.height/2); background.y = game.height/2; Sprite header = new Sprite(UtilStrings.SpritesPause + "header_pause.png"); header.SetOrigin(header.width/2, header.height/2); header.SetXY(background.width/2, 200); _buttons = new[] { new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width/2, 350, "Resume"), new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width/2, 450, _level.GetLevelName()), new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width/2, 550, "MainMenu") }; AddChild(background); AddChild(header); foreach (Button button in _buttons) { AddChild(button); } _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav"); _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav"); }
private void handleDigging2Scene() { if (_ds2 == null) { _ds2 = new Diggingsite("diggingsite2easy.png", 23, 1); AddChild(_ds2); _taptocontinue = new Sprite("taptocontinue.png"); AddChild(_taptocontinue); _taptocontinue.SetXY(650, 690); } if (_startItLooksText) { ((MyGame)game).StopSound(); ((MyGame)game).Talk(); ((MyGame)game).Play("It_looks.wav", 11000); _startItLooksText = false; } else if (_startItLooksText != true && Input.GetMouseButtonDown(0)) { targetTime = Time.time + deltaTime; ((MyGame)game).StopSound(); ((MyGame)game).Down(); } if (targetTime < Time.time && targetTime != 0) { { targetTime = 0; _taptocontinue.LateDestroy(); setScene(Scene.JIGSAW); } } }
private void SetHeader() { _header = new Sprite(UtilStrings.SpritesOther + "gameover/header_gameover.png"); _header.SetOrigin(_header.width/2, _header.height/2); _header.SetXY(game.width/2, 250); AddChild(_header); }
//------------------------------------------------------------------------ // makeDownArrow //------------------------------------------------------------------------ private void makeDownArrow() { downArrow = new Sprite("downarrow.png"); downArrow.SetXY(game.width / 2, game.height - 250); downArrow.SetScaleXY(0.5f); AddChild(downArrow); }
private void SetHeader() { _header = new Sprite(UtilStrings.SpritesOther + "levelbeaten/level_complete.png"); _header.SetOrigin(_header.width / 2, _header.height / 2); _header.SetXY(game.width / 2, 250); AddChild(_header); }
public HistoricImageHud(string historyFileName) : base("data/White Texture.png", true, false) { var bg = new EasyDraw(game.width, game.height, false); bg.Clear(Color.FromArgb(0, Color.Black)); AddChild(bg); _mainImage = new Sprite(historyFileName, true, false); AddChild(_mainImage); //_mainImage.scale = 0.5f; _mainImage.SetOriginToCenter(); _mainImage.SetXY(MyGame.HALF_SCREEN_WIDTH, MyGame.HALF_SCREEN_HEIGHT); DrawableTweener.TweenSpriteAlpha(_mainImage, 0, 1, 400, Easing.Equation.CubicEaseOut); var textBg = new EasyDraw(game.width, 30, false); textBg.Clear(Color.Black); AddChild(textBg); textBg.SetXY(0, game.height - 30); var pressToContinueText = new DebugTextBox("Press Esc to continue", game.width, 30, 0xffffff, 0x00010101, CenterMode.Center, CenterMode.Center); AddChild(pressToContinueText); pressToContinueText.SetXY(0, game.height - 30); DrawableTweener.Blink(pressToContinueText, 1, 0, 400); }
public Environment() { HubBackground = new Sprite("HubNoAnimals.png"); AddChild(HubBackground); _penguin = new Sprite("HubPenguin.png"); AddChild(_penguin); _penguin.SetXY(game.width / 2 + 550, 520); _monkey = new Sprite("HubMonkey.png"); AddChild(_monkey); _monkey.SetXY(game.width / 2, -20); _giraffe = new Sprite("HubGiraffe.png"); AddChild(_giraffe); _giraffe.SetXY(game.width / 2 - 950, 0); _giraffe.visible = false; _lion = new Sprite("HubLion.png"); AddChild(_lion); _lion.SetXY(game.width / 2 - 600, 750); _zebra = new Sprite("HubZebra.png"); AddChild(_zebra); _zebra.SetXY(game.width / 2 - 950, 450); _zebra.visible = false; _hippo = new Sprite("HubHippo.png"); AddChild(_hippo); _hippo.SetXY(game.width / 2 - 400, 100); _hippo.visible = false; _seaLion = new Sprite("HubSeaLion.png"); AddChild(_seaLion); _seaLion.SetXY(game.width / 2 + 400, 200); _seaLion.visible = false; _turtle = new Sprite("HubTurtle.png"); AddChild(_turtle); _turtle.SetXY(game.width / 2 + 250, 760); _turtle.visible = false; //0 animals.Add(_penguin); //1 animals.Add(_monkey); //2 animals.Add(_giraffe); //3 animals.Add(_lion); //4 animals.Add(_zebra); //5 animals.Add(_hippo); //6 animals.Add(_seaLion); //7 animals.Add(_turtle); }
//------------------------------------------------------------------------ // makeSoundIcon //------------------------------------------------------------------------ private void makeSoundIcon() { soundIcon = new Sprite("sound.png"); soundIcon.SetOrigin(soundIcon.width / 2, soundIcon.height / 2); soundIcon.SetXY(game.width / 3 + 130, game.height / 3 * 2); soundIcon.width /= 3; soundIcon.height /= 3; }
//------------------------------------------------------------------------------------------------------------ // menuSetup //------------------------------------------------------------------------------------------------------------ private void menuSetup() { AddChild(_menuBackGround); AddChild(_menuText); _menuText.SetXY(width - width / 4 - 50, height - height / 4); _menuText.SetOrigin(_menuText.width / 2, _menuText.height / 2); AddChild(_menuIdleBill); }
//------------------------------------------------------------------------ // private void makeHomeIcon() //------------------------------------------------------------------------ private void makeHomeIcon() { home = new Sprite("home_icon.png"); home.SetOrigin(home.width / 2, home.height / 2); home.SetXY(game.width / 13, game.height - 150); home.width /= 3; home.height /= 3; }
//------------------------------------------------------------------------ // makeMusicIcon //------------------------------------------------------------------------ private void makeMusicIcon() { musicIcon = new Sprite("music.png"); musicIcon.SetOrigin(musicIcon.width / 2, musicIcon.height / 2); musicIcon.SetXY(game.width / 3 + 130, game.height / 3); musicIcon.width /= 3; musicIcon.height /= 3; }
void AddBox(Vec2 position) { Sprite korobka = new Sprite("box.png"); korobka.SetXY(position.x, position.y); AddChild(korobka); _boxes.Add(korobka); }
//------------------------------------------------------------------------ // makeCross1 //------------------------------------------------------------------------ private void makeCross1() { cross1 = new Sprite("cross2.png"); cross1.SetOrigin(cross1.width / 2, cross1.height / 2); cross1.SetXY(game.width / 3 + 130, game.height / 3); cross1.width /= 4; cross1.height /= 4; }
//------------------------------------------------------------------------ // makeTextMusic //------------------------------------------------------------------------ private void makeTextMusic() { textMusic = new Sprite("music_icon.png"); textMusic.SetOrigin(textMusic.width / 2, textMusic.height / 2); textMusic.SetXY(game.width / 3 * 2 - 130, game.height / 3); textMusic.width /= 3; textMusic.height /= 3; }
public void TextBalloon(string fileName) { Sprite _text = new Sprite(fileName); AddChild(_text); _text.SetXY(420, 400); textBalloon.Add(_text); }
//------------------------------------------------------------------------ // makeTextSound //------------------------------------------------------------------------ private void makeTextSound() { textSound = new Sprite("sound_icon.png"); textSound.SetOrigin(textSound.width / 2, textSound.height / 2); textSound.SetXY(game.width / 3 * 2 - 130, game.height / 3 * 2); textSound.width /= 3; textSound.height /= 3; }
public Wizard(float x, float y) : base("Data/AnimationSprites/wizard.png", 5, 1) { SetScaleXY(1.2f); this.x = x; this.y = y - 32 - this.height; currentFrame = 1; _timerRandomAction = new System.Timers.Timer(); _timerRandomAction.Elapsed += new ElapsedEventHandler(timerRandomActionCompleted); _timerRandomAction.Interval = 100; _timerRandomAction.Enabled = true; _timerHideLifeBar = new System.Timers.Timer(); _timerHideLifeBar.Elapsed += new ElapsedEventHandler(timerHideLifeBarCompleted); _timerHideLifeBar.Interval = 500; _timerHideLifeBar.Enabled = false; _timerCanAttack = new System.Timers.Timer(); _timerCanAttack.Elapsed += new ElapsedEventHandler(timerCanAttackCompleted); _timerCanAttack.Interval = 1000; _timerCanAttack.Enabled = false; _status = new Status(); AddChild(_status); _movingRight = true; _canSpawnProjectile = true; _frameRate = 12; _speed = 2; _canFlip = true; _currentWeapon = new Weapon(); _currentWeapon.SetWeapon(4); AddChild(_currentWeapon); _screenSection = Convert.ToInt32(Math.Floor(this.x / 800)); _colliderBox = new Collider("Data/Sprites/HitBox.png", this); _colliderBox2 = new Collider("Data/Sprites/HitBox2.png", this); _colliderBox2.SetOrigin(-20, -20); AddChild(_colliderBox); AddChild(_colliderBox2); _lifeBar = new LifeBar(); _lifeBar.SetXY(-10, -5); _lifeBar.visible = false; AddChild(_lifeBar); _lifePoints = 100; _hitSprite = new Sprite("Data/Sprites/hit.png"); AddChild(_hitSprite); _hitSprite.visible = false; _hitSprite.SetScaleXY(0.8f); _hitSprite.SetXY(0, 15); _player = ((MyGame)game).GetPlayer(); }
public void SetSprite(string file, Vector2 pos, Vector2 size) { Sprite s = new Sprite(file, false, false); s.SetOrigin(s.width / 2, s.height / 2); //center origin s.SetScaleXY(size.x, size.y); //set size s.SetXY(pos.x, pos.y); //set position AddChild(s); }
public WonGame(TimeGuardianGame game) { _game = game; Sprite background = new Sprite(UtilStrings.SpritesOther + "gamewon/background.png"); Sprite header = new Sprite(UtilStrings.SpritesOther + "gamewon/header.png"); header.SetXY(100, game.height-400); AddChild(background); AddChild(header); }
private void handleDigging3Scene() { if (_ds3 == null) { _ds3 = new Diggingsite("diggingsite3easy.png", 23, 1); AddChild(_ds3); _taptocontinue = new Sprite("taptocontinue.png"); AddChild(_taptocontinue); _taptocontinue.SetXY(650, 690); } if (_startAmazingText) { ((MyGame)game).Talk(); ((MyGame)game).Play("Amazing.wav", 5000); _startAmazingText = false; } else if (Input.GetMouseButtonDown(0) && _startAmazingText != true && _startWellText) { ((MyGame)game).StopSound(); ((MyGame)game).Play("Well.wav", 1000); _startWellText = false; } else if (Input.GetMouseButtonDown(0) && _startWellText != true && _startItWasNiceText) { ((MyGame)game).StopSound(); ((MyGame)game).Play("It_was_nice.wav", 10000); _startItWasNiceText = false; } else if (_startItWasNiceText != true && Input.GetMouseButtonDown(0) && _makeLastButtonOnce) { ((MyGame)game).StopSound(); ((MyGame)game).Down(); _goBackMenu = new Button("arrowL_spritesheet_2.png", new Vec2(900, 700), 7, 1); AddChild(_goBackMenu); _makeLastButtonOnce = false; } if (_goBackMenu != null) { if (_goBackMenu.Pressed && _isGoBackMenuPressed != true) { _isGoBackMenuPressed = true; if (_ds3 != null) { _taptocontinue.LateDestroy(); _ds3.LateDestroy(); _ds3 = null; } } } }
//------------------------------------------------------------------------------------------------------------ // createGameWin //------------------------------------------------------------------------------------------------------------ private void createGameWin() { if (_isEndScreenOn == false) { _timer = new Timer(); _timer.PauseTime(); _timer.SetTime(_level.GetTime()); _timer.SetXY(width / 2 - 25, height - height / 3 - 15); _timer.width += _timer.width / 2; _timer.height += _timer.height / 2; RemoveChild(_level); AddChild(_winGameScreen); AddChild(_endText); _endText.SetXY(width / 2, height - height / 10); _endText.SetOrigin(_endText.width / 2, _endText.height / 2); AddChild(_timer); _isEndScreenOn = true; } }
public Journal(Level level) : base() { this.level = level; freshFish = new List <Fish>(); seaFish = new List <Fish>(); deepFish = new List <Fish>(); freshButtons = new List <Button>(); seaButtons = new List <Button>(); deepButtons = new List <Button>(); categories = new List <Button>(); fishSprites = new List <Sprite>(); listToShow = freshFish; buttonsToShow = freshButtons; journalButton = new Sprite("journalbutton.png"); journalButton.SetXY(game.width - 250, game.height - 200); close = new Sprite("jurnalClose.png"); journal = new Sprite("journalitself.png"); journal.SetXY(50, 0); close.SetXY(journal.x + journal.width - close.width, journal.y); canvas = new Canvas(journal.width, journal.height); descriptionCanvas = new Canvas(500, 500); category = 1; AddChild(journalButton); AddChild(journal); AddChild(close); AddChild(canvas); AddChild(descriptionCanvas); journal.alpha = 0f; close.alpha = 0f; titleFont = new Font("Times New Roman", 24); textFont = new Font("Times New Roman", 16); inWindow = false; for (int i = 0; i < 3; i++) { string text = ""; switch (i) { case 0: text = "Fresh Fish"; break; case 1: text = "Sea Fish"; break; case 2: text = "Deep Fish"; break; } Button button = new Button(new Vec2(journal.x + 50 + 110 * i, journal.y + 50), 100, 50, text); categories.Add(button); } }
public void AddFish(Fish fish) { Button button = new Button(new Vec2(0, 0), 300, 30, fish.GetFishName()); Sprite spr = new Sprite(fish.GetFishName() + "-icon.png"); spr.SetXY(journal.x + 690, journal.y + 150); spr.SetScaleXY(0.2f); spr.alpha = 0f; buttons.Add(button); fishSprites.Add(spr); AddChild(spr); checkForType(fish, button, spr); }
private void UpdateHealth() { ResetHealth(); //health images (should be one less then lives, represents EXTRA lives) for (int i = 0; i < MyGame.scenes.player.GetHealth() - 1; i++) { Sprite sprite = new Sprite("extraLife.png", false, false); sprite.SetScaleXY(5.5f, 5.5f); sprite.SetXY(40 + ((i % 3) * 110), game.height * 0.45f + (90 * Mathf.Floor(i / 3))); liveSprites.Add(sprite); AddChild(sprite); } }
void initSprites() { moneyIcon = new Sprite("coin.png"); moneyIcon.SetScaleXY(0.06f); moneyIcon.SetXY(game.width - 200, 30); home = new Sprite("home_icon.png"); home.SetScaleXY(0.4f); home.SetXY(game.width / 2, game.height - home.height); hub = new Sprite("aquariums.png"); hub.SetScaleXY(0.9f); }
//------------------------------------------------------------------------ // setEmptySpaceDimensionAndPosition //------------------------------------------------------------------------ private void setEmptySpaceDimensionAndPosition() { emptySpace1.SetXY(game.width - 130, 140); emptySpace2.SetXY(game.width - 130, 270); emptySpace3.SetXY(game.width - 130, 400); emptySpace1.width += 40; emptySpace1.height += 30; emptySpace2.width += 40; emptySpace2.height += 30; emptySpace3.width += 40; emptySpace3.height += 30; emptySpace1.alpha = 0; emptySpace2.alpha = 0; emptySpace3.alpha = 0; }
public MemoryIndicatorPanel(bool keepInCache = false, bool addCollider = true) : base( "data/Hud Off Memory Indicator Panel.png", keepInCache, addCollider) { _onIndicatorSprite = new Sprite("data/Hud On Memory Indicator Panel.png", false, false); AddChild(_onIndicatorSprite); _onIndicatorSprite.SetXY(0, 0); _onIndicatorSprite.visible = false; CoroutineManager.StartCoroutine(Start(), this); var mouseHandler = new MMouseHandler(this); mouseHandler.OnMouseClick += (target, type) => { Console.WriteLine($"{this}: clicked"); }; mouseHandler.OnMouseOverTarget += (target, type) => { Console.WriteLine($"{this}: over"); }; mouseHandler.OnMouseOffTarget += (target, type) => { Console.WriteLine($"{this}: off"); }; }
private void handleDigging1Scene() { if (_ds1 == null) { _ds1 = new Diggingsite("diggingsite1easy.png", 23, 1); AddChild(_ds1); _taptocontinue = new Sprite("taptocontinue.png"); AddChild(_taptocontinue); _taptocontinue.SetXY(650, 690); } if (Input.GetMouseButtonDown(0)) { _taptocontinue.LateDestroy(); setScene(Scene.MIXANDMATCH); } }
public FishStand(float givenX, float givenY, float givenRotation) : base(givenX, givenY, "fishShop.png", givenRotation) { _buyMenu = new Sprite("buyScreen.png"); _buyMenu2 = new Sprite("buyScreen2.png"); _exitButton = new Sprite("exitCross.png"); _buyMenu.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2); _buyMenu.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150); _buyMenu2.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2); _buyMenu2.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150); _exitButton.SetXY(_buyMenu.x + 500, _buyMenu.y - 325); _menuShown = false; scale = 0.85f; _boughtItem = new EasyDraw(1920, 1080); _boughtItem.TextSize(16); _boughtItem.SetColor(0, 0, 0); }
//------------------------------------------------------------------------------------ // backgroundSetup //------------------------------------------------------------------------------------ private void backgroundSetup() { _backgroundDark = new Sprite("New Background Blurred Arcade Size2 copy.png"); _backgroundDark.SetOrigin(_backgroundDark.width / 2, _backgroundDark.height / 2); _backgroundDark.SetXY(this._width / 2, this._height / 2); AddChild(_backgroundDark); _backgroundLight = new Sprite("New Background Blurred Arcade Size.png"); _backgroundLight.SetOrigin(_backgroundLight.width / 2, _backgroundLight.height / 2); _backgroundLight.SetXY(this._width / 2, this._height / 2); AddChild(_backgroundLight); _backgroundLine = new Sprite("New_Background_Lines_Arcade_Size.png"); _backgroundLine.SetOrigin(_backgroundLine.width / 2, _backgroundLine.height / 2); _backgroundLine.SetXY(this._width / 2, this._height / 2); AddChild(_backgroundLine); }
public Shelf(Vec2 nostart, Vec2 noend, float shelfRotation, string filename) : base(nostart, noend) { end.RotateAroundDegrees(shelfRotation, nostart); //start.RotateAroundDegrees(trampRotation, noend); shelf = new Sprite(filename, false, false); _middle = (start + end) * 0.5f; AddChild(shelf); shelf.SetOrigin(shelf.width / 2, 0); shelf.rotation = shelfRotation; shelf.SetXY(_middle.x, _middle.y); }
private void updateNotch(int manaPoints) { for (int i = 0; i < _notchArray.Length; i++) { if (_notchArray[i] != null) { _notchArray[i].Destroy(); } } for (int i = 0; i < (manaPoints * 3) / 100; i++) { Sprite notch = new Sprite("Data/HUD/notch.png"); notch.SetXY(189 + 19 * i, 9); _notchArray[i] = notch; AddChild(notch); } }
private void SetHeader() { _header = new Sprite(UtilStrings.SpritesMenu + "header_logo.png"); _header.SetOrigin(_header.width/2, _header.height/2); _header.SetXY(game.width / 2, 120); AddChild(_header); }