예제 #1
0
        private void Initialize()
        {
            MapFullBounds = CreateMapFullBounds();
            VAdapterGame  = CreateViewport();
            VAdapterHUD   = CreateViewport();           // later perhaps diff adapters

            InternalBatch   = new SpriteBatch(Graphics.GraphicsDevice);
            FixedBatch      = new SpriteBatchWrapper(InternalBatch);
            TranslatedBatch = new SpriteBatchWrapper(InternalBatch);

            InputStateMan = new InputStateManager(VAdapterGame, VAdapterHUD, MapOffsetX, MapOffsetY);
            GameHUD       = CreateHUD();
            Background    = CreateBackground();

            Entities = CreateEntityManager();

            DebugDisp = new DummyDebugTextDisplay();

            GameHUD.Validate();

#if DEBUG
            FPSCounter = new RealtimeAPSCounter();
            UPSCounter = new RealtimeAPSCounter();
            GCMonitor  = new GCMonitor();

            DebugMap = CreateDebugMinimap();
#endif
        }
예제 #2
0
    //public void Load(Level level){
    public void Load(GameBackground background)
    {
        gameObject.SetActive(true);
        if (background != null)
        {
            GetComponent <SpriteRenderer>().sprite = background.PlaygroundSprite;

            setSprite(BackgroundCloud1, background.BackgroundCloud1);
            setSprite(BackgroundCloud2, background.BackgroundCloud2);
            setSprite(ForegroundCloud1, background.ForegroundCloud1);
            setSprite(ForegroundCloud2, background.ForegroundCloud2);
            setSprite(ForegroundCloud3, background.ForegroundCloud3);
            setSprite(Hill, background.Hill);
        }

        /*
         *      GetComponent<SpriteRenderer>().sprite = level.PlaygroundSprite;
         *      BackgroundCloud1.sprite = level.BackgroundCloud1;
         *      BackgroundCloud2.sprite = level.BackgroundCloud2;
         *      ForegroundCloud1.sprite = level.ForegroundCloud1;
         *      ForegroundCloud2.sprite = level.ForegroundCloud2;
         *      ForegroundCloud3.sprite = level.ForegroundCloud3;
         *      Hill.sprite = level.Hill;
         */
    }
예제 #3
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     ResetGameBackground();
 }
예제 #4
0
	// ================================================================
	//  Initialize
	// ================================================================
	protected void Awake () {
		// Identify references!
		gameBackgroundRef = this.transform.parent.gameObject.GetComponent<GameBackground> ();
		cameraControllerRef = gameBackgroundRef.GetCameraControllerRef ();

		particlePrefab = (GameObject)Resources.Load (GameProperties.GAME_BACKGROUND_PREFABS_PATH + ParticlePrefabName);
		
		InitializeParticles ();
	}
        protected override void OnInitialize(object enterInformation)
        {
            _globalTime = 0f;
            SoundService.RegisterSong("MainTheme", Game.Content.Load <Song>("sounds/hardebm"));

            _explosionManager = Game.RegisterGlobalObject("ExplosionManager", new ExplosionManager(Game));

            _player         = Game.RegisterGlobalObject("Player", new Player(Game, new Vector2(500f, 400f)));
            _carManager     = new CarManager(Game);
            _weather        = new Weather(Game);
            _player.weather = _weather;
            Game.DepthRenderer.Register(_player);
            _gameBackground = new GameBackground(Game);
            _gameBackground.SetAnimationTime(0.25f);
        }
예제 #6
0
        /// <summary>
        /// sprites are created based on level's content
        /// </summary>
        private void PrepareSprites()
        {
            /*
             * _currentLevelStrings = GameLogic.Instance.GetLevelContent(1, 1);
             * ShowLevel();
             */
            _gameBg          = new GameBackground();
            _gameBg.Texture  = content.Load <Texture2D>(GameConfig.GetBackground());
            _gameBg.Position = new Vector2(0, 0);

            _bot          = new Bot();
            _bot.Texture  = content.Load <Texture2D>(GameConfig.GetBot());
            _bot.Position = new Vector2(ScreenManager.Instance.Dimensions.X / 2,
                                        ScreenManager.Instance.Dimensions.Y / 2);
        }
예제 #7
0
        /// <summary>
        /// sprites are created based on level's content
        /// </summary>
        private void PrepareSprites()
        {
            /*
            _currentLevelStrings = GameLogic.Instance.GetLevelContent(1, 1);
            ShowLevel();
            */
            _gameBg = new GameBackground();
            _gameBg.Texture = content.Load<Texture2D>(GameConfig.GetBackground());
            _gameBg.Position = new Vector2(0, 0);

            _bot = new Bot();
            _bot.Texture = content.Load<Texture2D>(GameConfig.GetBot());
            _bot.Position = new Vector2(ScreenManager.Instance.Dimensions.X / 2,
                                        ScreenManager.Instance.Dimensions.Y / 2);
        }
예제 #8
0
        public void Init()
        {
            Input.ClearBindings();
            var player  = new PlayerBlob(Color.Red);
            var enemies = new List <EnemyBlob> {
                new EnemyBlob(), new EnemyBlob(), new EnemyBlob(), new EnemyBlob()
            };
            var gameBackground = new GameBackground();

            _visuals.Add(player);
            _visuals.AddRange(enemies);
            _visuals.Add(gameBackground);
            _automatons.Add(player);
            _automatons.AddRange(enemies);
            _automatons.Add(gameBackground);
        }
    public void TransitionToBackground(GameBackground destinationBackground)
    {
        if (destinationBackground != null && activeBackground == destinationBackground)
        {
            return;
        }

        // Turn off the current background
        if (activeBackground != null)
        {
            activeBackground.Deactivate(true);
        }

        // Turn on the new background
        activeBackground = destinationBackground;
        activeBackground.Activate(true);
    }
예제 #10
0
파일: Game.cs 프로젝트: EnigmaDragons/Dots
        public void Init()
        {
            World.PlayMusic("Music/thechase");
            Input.ClearBindings();
            Input.OnDirection(UpdateCamera);
            _camera = new Camera(new Vector2(775, 425));
            var player  = new PlayerBlob(Color.Red);
            var enemies = new List <EnemyBlob> {
                new EnemyBlob(), new EnemyBlob(), new EnemyBlob(), new EnemyBlob()
            };
            var gameBackground = new GameBackground();

            _visuals.Add(gameBackground);
            _visuals.Add(player);
            _visuals.AddRange(enemies);
            _automatons.Add(gameBackground);
            _automatons.Add(player);
            _automatons.AddRange(enemies);
        }
 public void Start()
 {
     Backgrounds.ForEach(bg => {
         bg.gameObject.SetActive(true);
         bg.Initialize();
         if (bg.ActiveAtStart)
         {
             if (activeBackground != null)
             {
                 throw new InvalidOperationException("Can't have more than one background active at start!");
             }
             bg.Activate(false);
             activeBackground = bg;
         }
         else
         {
             bg.Deactivate(false);
         }
     });
 }
예제 #12
0
        private void DrawGameplay(SpriteBatch spriteBatch, GameTime gameTime)
        {
            GameBackground.Draw(gameTime, spriteBatch);

            this._elements.Draw(spriteBatch);

            this.GameCharacter.Draw(spriteBatch);

            DrawOnetimeAnimations(spriteBatch);

            float position = 15;

            spriteBatch.DrawString(_font[2], "Level: " + this._currentLevel.ToString(), new Vector2(position, 20), GhostlyGame.MENU_FONT_COLOR);

            position = _font[2].MeasureString("Level: " + this._currentLevel.ToString()).X + 100;

            switch (this.GameCharacter.CurrentHealth)
            {
            case 3:
                spriteBatch.Draw(ImagesAndAnimations.Instance.HeartFull, new Rectangle((int)position, 20, 53, 45), Color.White);
                break;

            case 2:
                spriteBatch.Draw(ImagesAndAnimations.Instance.HeartHalf, new Rectangle((int)position, 20, 53, 45), Color.White);
                break;

            case 1:
                spriteBatch.Draw(ImagesAndAnimations.Instance.HeartEmpty, new Rectangle((int)position, 20, 53, 45), Color.White);
                break;

            default:
                spriteBatch.Draw(ImagesAndAnimations.Instance.InvisibleTile, new Rectangle((int)position, 20, 53, 45), Color.White);
                break;
            }

            position += 153;

            spriteBatch.DrawString(_font[2], "Score: " + GameCharacter.Score.ToString(), new Vector2(position, 20), GhostlyGame.MENU_FONT_COLOR);
        }
예제 #13
0
        public void LoadLevel()
        {
            this._gameState = GameState.Running;
            //clear elements & start logging
            this._elements = new LevelElements();
            OnGameStarted(_currentLevel);

            if (this._currentLevel <= 30)
            {
                this._level = new EarthLevel(this, this._elements);
                this._level.LoadMap("earth.map" + this._currentLevel + ".txt");
                GameBackground.SetParallaxLayers(new List <Texture2D> {
                    _level.BackgroundFurthest, _level.BackgroundFurther, _level.BackgroundFar, _level.BackgroundClose, _level.BackgroundCloser, _level.BackgroundClosest
                });
            }
            else if (this._currentLevel <= 60)
            {
                this._level = new WaterLevel(this, this._elements);
                this._level.LoadMap("water.map" + this._currentLevel + ".txt");
                GameBackground.SetParallaxLayers(new List <Texture2D> {
                    _level.BackgroundClose, _level.BackgroundCloser, _level.BackgroundClosest
                });
            }
            else if (this._currentLevel <= 90)
            {
                this._level = new RockLevel(this, this._elements);
                this._level.LoadMap("rock.map" + this._currentLevel + ".txt");
                GameBackground.SetParallaxLayers(new List <Texture2D> {
                    _level.BackgroundFurthest, _level.BackgroundClose, _level.BackgroundClosest
                });
            }
            this.GameCharacter                 = this._level.Character;
            GameBackground.ContinuousLayer     = this._level.Background;
            GhostlyActionHandlers.CurrentLevel = this._level;

            Position = Vector3.Zero;
            GhostlyGame.Instance.GameObjects.TryUpdate("PlayerPosition", Position);
        }
    public static GameBackground create(
//		Sprite playgroundSprite,
//		Sprite backgroundCloud1,
//		Sprite backgroundCloud2,
//		Sprite foregroundCloud1,
//		Sprite foregroundCloud2,
//		Sprite foregroundCloud3,
//		Sprite hill
        )
    {
        //GameBackground gameBackground = new GameBackground ();
        GameBackground gameBackground = ScriptableObject.CreateInstance <GameBackground>();

        /*
         * gameBackground.PlaygroundSprite = playgroundSprite;
         * gameBackground.BackgroundCloud1 = backgroundCloud1;
         * gameBackground.BackgroundCloud2 = backgroundCloud2;
         * gameBackground.ForegroundCloud1 = foregroundCloud1;
         * gameBackground.ForegroundCloud2 = foregroundCloud2;
         * gameBackground.ForegroundCloud3 = foregroundCloud3;
         * gameBackground.Hill = hill;
         */
        return(gameBackground);
    }
예제 #15
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            control.state = paranothing.GameState.MainMenu;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            spriteBatch2 = new SpriteBatch(GraphicsDevice);

            //Stuff for fade
            stopwatch = new Stopwatch();
            white = Content.Load<Texture2D>("white");

            audioEngine = new AudioEngine(@"Content/Sounds/sounds.xgs");
            waveBank = new WaveBank(audioEngine, @"Content/Sounds/Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content/Sounds/Sound Bank.xsb");
            soundMan.setSoundBank(ref soundBank);
            bgMusic = Content.Load<Song>("Sounds/Soundtrack");
            MediaPlayer.Play(bgMusic);
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.1f;

            greyScale = Content.Load<Effect>("Greyscale");

            wallpaperTex = Content.Load<Texture2D>("Sprites/Wallpaper");
            wallpaperSheet = new SpriteSheet(wallpaperTex);
            wallpaperSheet.splitSheet(1, 2);

            wardrobeTex = Content.Load<Texture2D>("Sprites/wardrobe");
            wardrobeSheet = new SpriteSheet(wardrobeTex);
            wardrobeSheet.splitSheet(1, 5);
            wardrobeSheet.addAnimation("wardrobeclosed", new int[] { 0 });
            wardrobeSheet.addAnimation("wardrobeopening", new int[] { 1, 2, 3 });
            wardrobeSheet.addAnimation("wardrobeopen", new int[] { 4 });

            //Portrait
            portraitTex = Content.Load<Texture2D>("Sprites/portrait");
            portraitSheet = new SpriteSheet(portraitTex);
            portraitSheet.splitSheet(2, 1);

            rubbleTex = Content.Load<Texture2D>("Sprites/rubble");
            rubbleSheet = new SpriteSheet(rubbleTex);
            rubbleSheet.addSprite(0, 0, 37, 28);

            actionTex = Content.Load<Texture2D>("Sprites/actions");
            actionSheet = new SpriteSheet(actionTex);
            actionSheet.splitSheet(3, 3);
            actionSheet.addAnimation("bubble", new int[] { 0 });
            actionSheet.addAnimation("wardrobe", new int[] { 1 });
            actionSheet.addAnimation("push", new int[] { 2 });
            actionSheet.addAnimation("chair", new int[] { 3 });
            actionSheet.addAnimation("stair", new int[] { 4 });
            actionSheet.addAnimation("portrait", new int[] { 5 });
            actionSheet.addAnimation("oldportrait", new int[] { 6 });
            actionSheet.addAnimation("bookcase", new int[] { 7 });
            actionSheet.addAnimation("negate", new int[] { 8 });

            boyTex = Content.Load<Texture2D>("Sprites/BruceSheet");
            boySheet = new SpriteSheet(boyTex);
            boySheet.splitSheet(7, 9, 0, 0, 58);
            boySheet.addAnimation("walk", new int[] { 0, 1, 2, 3, 4, 5, 6, 7 });
            boySheet.addAnimation("stand", new int[] { 8 });
            boySheet.addAnimation("leavewardrobe", new int[] { 9, 10, 11, 12, 13, 14, 15, 16 });
            boySheet.addAnimation("enterwardrobe", new int[] { 18, 19, 20, 21, 22, 23, 24, 25 });
            boySheet.addAnimation("enterportrait", new int[] { 27, 28, 29, 30, 31, 32, 33, 34 });
            boySheet.addAnimation("leaveportrait", new int[] { 34, 33, 32, 31, 30, 29, 28, 27 });
            boySheet.addAnimation("startpush", new int[] { 36, 37, 38, 39 });
            boySheet.addAnimation("endpush", new int[] { 39, 38, 37, 36 });
            boySheet.addAnimation("push", new int[] { 41, 42, 43, 44, 45, 46, 47, 48 });
            boySheet.addAnimation("pushstill", new int[] { 49 });
            boySheet.addAnimation("controlstart", new int[] { 50, 51, 52 });
            boySheet.addAnimation("control", new int[] { 53 });
            boySheet.addAnimation("controlend", new int[] { 52, 51, 50 });
            boySheet.addAnimation("disappear", new int[] { 50, 51, 52, 53, 54, 55, 56, 57 });

            shadowTex = Content.Load<Texture2D>("Sprites/Shadow");
            shadowSheet = new SpriteSheet(shadowTex);
            shadowSheet.splitSheet(1, 4);
            shadowSheet.addAnimation("walk", new int[] { 0, 1, 2 });
            shadowSheet.addAnimation("stopwalk", new int[] { 2, 1, 0 });
            shadowSheet.addAnimation("stand", new int[] { 3 });

            floorTex = Content.Load<Texture2D>("Sprites/floor");
            floorSheet = new SpriteSheet(floorTex);
            floorSheet.splitSheet(2, 1);

            wallTex = Content.Load<Texture2D>("Sprites/wall");
            wallSheet = new SpriteSheet(wallTex);
            wallSheet.splitSheet(1, 2);

            stairTex = Content.Load<Texture2D>("Sprites/Staircase");
            stairSheet = new SpriteSheet(stairTex);
            stairSheet.splitSheet(1, 2);

            doorTex = Content.Load<Texture2D>("Sprites/door");
            doorSheet = new SpriteSheet(doorTex);
            doorSheet.splitSheet(2, 3);
            doorSheet.addAnimation("doorclosedpast", new int[] { 0 });
            doorSheet.addAnimation("dooropeningpast", new int[] { 1 });
            doorSheet.addAnimation("dooropenpast", new int[] { 2 });
            doorSheet.addAnimation("doorclosedpresent", new int[] { 3 });
            doorSheet.addAnimation("dooropeningpresent", new int[] { 4 });
            doorSheet.addAnimation("dooropenpresent", new int[] { 5 });

            //Old Portrait
            oldPortraitTex = Content.Load<Texture2D>("Sprites/PortraitWoman");
            oldPortraitSheet = new SpriteSheet(oldPortraitTex);
            oldPortraitSheet.splitSheet(2, 1);

            keyTex = Content.Load<Texture2D>("Sprites/Key");
            keySheet = new SpriteSheet(keyTex);
            keySheet.splitSheet(2, 1);

            chairTex = Content.Load<Texture2D>("Sprites/chair");
            chairSheet = new SpriteSheet(chairTex);
            chairSheet.splitSheet(1, 2);

            finalDoorTex = Content.Load<Texture2D>("Sprites/door_final");
            finalDoorSheet = new SpriteSheet(finalDoorTex);
            finalDoorSheet.splitSheet(1, 7);
            finalDoorSheet.addAnimation("bookcaseclosed", new int[] { 0 });
            finalDoorSheet.addAnimation("bookcaseopening", new int[] { 1, 2, 3, 4, 5 });
            finalDoorSheet.addAnimation("bookcaseclosing", new int[] { 5, 4, 3, 2, 1 });
            finalDoorSheet.addAnimation("bookcaseopen", new int[] { 6 });

            buttonTex = Content.Load<Texture2D>("Sprites/button");
            buttonSheet = new SpriteSheet(buttonTex);
            buttonSheet.splitSheet(1, 2);

            sheetMan.addSheet("wallpaper", wallpaperSheet);
            sheetMan.addSheet("wardrobe", wardrobeSheet);
            sheetMan.addSheet("portrait", portraitSheet);
            sheetMan.addSheet("rubble", rubbleSheet);
            sheetMan.addSheet("action", actionSheet);
            sheetMan.addSheet("boy", boySheet);
            sheetMan.addSheet("floor", floorSheet);
            sheetMan.addSheet("wall", wallSheet);
            sheetMan.addSheet("stair", stairSheet);
            sheetMan.addSheet("door", doorSheet);
            sheetMan.addSheet("oldportrait", oldPortraitSheet);
            sheetMan.addSheet("key", keySheet);
            sheetMan.addSheet("chair", chairSheet);
            sheetMan.addSheet("bookcase", finalDoorSheet);
            sheetMan.addSheet("button", buttonSheet);
            sheetMan.addSheet("shadow", shadowSheet);

            actionBubble = new ActionBubble();
            player = new Boy(254, 240, actionBubble);
            Camera camera = new Camera(0, 360, 1280, 720, 2.0f);
            tutorial = new Level("levels/tutorial.lvl");
            level1 = new Level("levels/level1.lvl");
            level2 = new Level("levels/level2.lvl");
            level3 = new Level("levels/level3.lvl");
            level4 = new Level("levels/level4.lvl");
            control.addLevel(tutorial);
            control.addLevel(level1);
            control.addLevel(level2);
            control.addLevel(level3);
            control.addLevel(level4);
            control.goToLevel("Tutorial");

            GameTitle.levelName = "Tutorial";

            control.setPlayer(player);
            control.setCamera(camera);
            control.initLevel(false);

            controller = Content.Load<Texture2D>("controller");

            // TODO: use this.Content to load your game content here
            loadTitleContents();
            description = new GameBackground(Content.Load<Texture2D>("GameThumbnail"), new Rectangle(0, 0, (int)(ScreenWidth), (int)(ScreenHeight)));
        }
예제 #16
0
        public override void Load()
        {
            random = new Random();

            background = new GameBackground();
            AddChild(background);
            background.Y += GameMain.ScreenHeight * 0.2f;
            gameContainer = new Sprite();
            AddChild(gameContainer);

            player = new Player();
            player.X = 5 * Level.TILE_SIZE;
            player.Y = 5 * Level.TILE_SIZE;

            objects = new List<MovingObject>();
            objects.Add(player);
            bullets = new List<Bullet>();

            particleTexture = Assets.GetBitmapData("blood");
            particles = new List<Particle>();

            level = new Level(1);

            gameContainer.AddChild(level);

            gameInterface = new GameInterface();
            #if __MOBILE__
            AddChild(gameInterface);
            gameInterface.left.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin);
            gameInterface.right.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin);
            gameInterface.up.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin);
            gameInterface.left.AddEventListener(Event.TOUCH_END, buttonTouchEnd);
            gameInterface.right.AddEventListener(Event.TOUCH_END, buttonTouchEnd);
            gameInterface.up.AddEventListener(Event.TOUCH_END, buttonTouchEnd);
            gameInterface.fire.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin);
            #endif
            inputX = 0;
            inputY = 0;

            tutorText = new TextField();
            tutorText.font = Assets.GetFont("MainFont");
            tutorText.text = "JUMP!!!";
            tutorText.X = (PHYS_BEGIN + 1) * Level.TILE_SIZE;
            tutorText.Y = 5 * Level.TILE_SIZE;

            gameContainer.AddChild(player);

            var zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 5 * Level.TILE_SIZE;
            zombie.Y = 5 * Level.TILE_SIZE;

            zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 10 * Level.TILE_SIZE;
            zombie.Y = 6 * Level.TILE_SIZE;

            zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 11 * Level.TILE_SIZE;
            zombie.Y = 5 * Level.TILE_SIZE;

            var zombie2 = new Bug(player);
            gameContainer.AddChild(zombie2);
            objects.Add(zombie2);
            zombie2.X = 7 * Level.TILE_SIZE;
            zombie2.Y = 4 * Level.TILE_SIZE;

            zombie2 = new Bug(player);
            gameContainer.AddChild(zombie2);
            objects.Add(zombie2);
            zombie2.X = 15 * Level.TILE_SIZE;
            zombie2.Y = 9 * Level.TILE_SIZE;

            zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 30 * Level.TILE_SIZE;
            zombie.Y = 5 * Level.TILE_SIZE;

            zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 32 * Level.TILE_SIZE;
            zombie.Y = 6 * Level.TILE_SIZE;

            zombie = new Zombie(player);
            gameContainer.AddChild(zombie);
            objects.Add(zombie);
            zombie.X = 35 * Level.TILE_SIZE;
            zombie.Y = 5 * Level.TILE_SIZE;

            zombie2 = new Bug(player);
            gameContainer.AddChild(zombie2);
            objects.Add(zombie2);
            zombie2.X = 40 * Level.TILE_SIZE;
            zombie2.Y = 8 * Level.TILE_SIZE;

            zombie2 = new Bug(player);
            gameContainer.AddChild(zombie2);
            objects.Add(zombie2);
            zombie2.X = 55 * Level.TILE_SIZE;
            zombie2.Y = 9 * Level.TILE_SIZE;

            gameContainer.AddChild(tutorText);
        }
예제 #17
0
 public void Initialize()
 {
     GameBackground = new GameBackground(0, SPEED, Screen);
 }
예제 #18
0
 public void DrawBackground(GameInstance self, GameBackground background, double x, double y, bool tiled,
                            bool relative = false)
 {
     throw new NotImplementedException();
 }
예제 #19
0
 public void ReplaceBackground(GameBackground background, string filename)
 {
     throw new NotImplementedException();
 }
예제 #20
0
        public void ResetGame()
        {
            gameInProgress = false;
            
            actionBubble = new ActionBubble();
            player = new Boy(254, 240, actionBubble);
            //control.goToLevel("Tutorial");

            //GameTitle.levelName = "Tutorial";

            Camera camera = new Camera(0, 360, 1280, 720, 2.0f);

            //control.level = l;
            control.setPlayer(player);
            control.setCamera(camera);
            control.initLevel(false);

            //loadTitleContents();
            description = new GameBackground(Content.Load<Texture2D>("GameThumbnail"), new Rectangle(0, 0, (int)(ScreenWidth), (int)(ScreenHeight)));

            fadeOpacity = 0;

        }
예제 #21
0
 public void ShowHighscore(GameBackground background, bool showBorder, int newColor, int otherColor,
                           string fontString)
 {
     throw new NotImplementedException();
 }
예제 #22
0
        public override void Start()
        {
            base.Start();

            MainClass.LoadAssets(Engine);

            TextConfig.Default = new TextConfig(new Asset("font.png"), charToSprite,
                                                paddingFunc: (float width) =>
            {
                float result = width;
                result      *= -0.066f;
                return(result);
            });

            GameBackground.Initialize(Engine);

            Engine.SpawnObject(new CharactersInfo());

            var logoAsset = (SpriteAsset)Engine.GetAsset("logo");
            var logoObj   = new SpriteObject(logoAsset.Width, logoAsset.Height)
            {
                CurrentSprite = logoAsset
            };

            logoObj.X = Engine.Width / 2 - logoObj.Width / 2;
            logoObj.Y = Engine.Height / 2 - logoObj.Height / 2;
            // game controls text
            var padding      = 3f;
            var fontSize     = 0.66f;
            var gameControls = new TextObject(fontSize, Color.White);

            gameControls.Text = "WASD: movements";
            var gameControlsSize = gameControls.Measure();

            gameControls.X = Engine.Width / 2 - gameControlsSize.X / 2;
            gameControls.Y = logoObj.Y + logoObj.Height + padding;
            var gameControls2 = new TextObject(fontSize, Color.White);

            gameControls2.Text = "Arrows+QEZC: shot";
            var gameControls2Size = gameControls2.Measure();

            gameControls2.X = Engine.Width / 2 - gameControls2Size.X / 2;
            gameControls2.Y = gameControls.Y + gameControlsSize.Y + padding;
            var gameControls3 = new TextObject(fontSize, Color.White);

            gameControls3.Text = "F: change spell";
            var gameControls3Size = gameControls3.Measure();

            gameControls3.X = Engine.Width / 2 - gameControls3Size.X / 2;
            gameControls3.Y = gameControls2.Y + gameControls2Size.Y + padding;
            var gameControls4 = new TextObject(fontSize, Color.White);

            gameControls4.Text = "M: map - Esc: pause";
            var gameControls4Size = gameControls4.Measure();

            gameControls4.X = Engine.Width / 2 - gameControls4Size.X / 2;
            gameControls4.Y = gameControls3.Y + gameControls3Size.Y + padding;
            var continueText = new TextObject(fontSize, Color.White);

            continueText.Text = "Press anything to play!";
            var continueTextSize = continueText.Measure();

            continueText.X = Engine.Width / 2 - continueTextSize.X / 2;
            continueText.Y = Engine.Height - padding - continueTextSize.Y;

            Engine.SpawnObject("logo", logoObj);
            Engine.SpawnObject("logo_controls", gameControls);
            Engine.SpawnObject("logo_controls2", gameControls2);
            Engine.SpawnObject("logo_controls3", gameControls3);
            Engine.SpawnObject("logo_controls4", gameControls4);
            Engine.SpawnObject("logo_continueText", continueText);
            MainWindow = "logo";

            BasicItems.Initialize(Engine);

            AudioSource.Volume = 0.66f;
            AudioSource.Stream(((AudioAsset)Engine.GetAsset("sound_soundtrack")).FileName, true);
        }