Exemple #1
0
        public async void Initialize()
        {
            this.machine.Frame = 0;

            this.homeState = HomeStates.Home;

            this.title = AssetStore.Title;
            this.maps  = AssetStore.ParallaxMaps;
            this.tiles = AssetStore.Tiles;

            cursor = AssetStore.OpaCursorAnimator;

            this.menuStart.Initialize(machine, cursor, menuEntries);
            this.menu1Por2P.Initialize(machine, cursor, menu1Por2Pentries);

            frameScroll = 0;

            hiScore       = this.machine.BatteryRam.ReadInt((int)BatteryRamAddress.HiScore);
            hiScoreString = "hiscore: " + hiScore;

            this.fontWidth = this.machine.Screen.Font.FontSheet.TileWidth;

            this.machine.Audio.PlayLoop("homeSound");

            await this.machine.ExecuteAsync(() => this.game.SaveNameAndScoreIfNeededAsync());

            cursor.Start();
        }
Exemple #2
0
        public BombSprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;
            this.page    = page;

            tiles = AssetStore.Tiles;

            return(this);
        }
Exemple #3
0
        public AmmoSprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;
            this.page    = page;

            tiles = AssetStore.Tiles;

            this.Width  = 8;
            this.Height = 8;

            this.InitializeCollision(0);

            return(this);
        }
Exemple #4
0
        public BabySprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;

            this.page    = page;
            tiles        = AssetStore.Tiles;
            walkAnimator = AssetStore.CreateBabyAnimation();

            this.Width  = walkAnimator.Width;
            this.Height = walkAnimator.Height;

            this.InitializeCollision(3);

            return(this);
        }
Exemple #5
0
        public FlySprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;

            this.page   = page;
            tiles       = AssetStore.Tiles;
            flyAnimator = AssetStore.CreateFlyAnimation();
            flyIndex    = 0;

            this.Width  = 16;
            this.Height = 16;

            this.InitializeCollision(3);

            return(this);
        }
Exemple #6
0
        public CoinSprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;

            this.page = page;
            tiles     = AssetStore.Tiles;

            coin1Animator = AssetStore.CreateCoin1Animation();
            coin5Animator = AssetStore.CreateCoin5Animation();

            this.Width  = 16;
            this.Height = 16;

            this.InitializeCollision(3);

            return(this);
        }
Exemple #7
0
        public KaboomSprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;
            this.page    = page;

            tiles = AssetStore.Tiles;

            kaboomAnimator = AssetStore.CreateKaboomAnimation();

            this.Width  = 8;
            this.Height = 8;

            kaboomAnimator.Stop();

            Width  = kaboomAnimator.Width;
            Height = kaboomAnimator.Height;

            return(this);
        }
Exemple #8
0
        public OpaSprite(Machine machine, PlayPage page)
        {
            this.machine = machine;

            this.page = page;

            pathDeathStart.Initialize(EasingFunctions.CircularEaseOut, EasingFunctions.Linear, 40, 1, 1, 1, 100);

            frameDeathStarThresold0 = (int)((double)pathDeathStart.MaximumFrame * 0.4d);
            frameDeathStarThresold1 = (int)((double)pathDeathStart.MaximumFrame * 0.8d);

            tiles          = AssetStore.Tiles;
            flightAnimator = AssetStore.OpaFlightAnimator;
            walkAnimator   = AssetStore.OpaWalkAnimator;

            deathStarAnimator = AssetStore.CreateDeathStartAnimation();
            deathStarAnimator.AnimationType = AnimationTypes.Manual;

            isOpaHorizontalFlipped = true;

            Initialize();
        }
Exemple #9
0
        public MotherSprite Create(Machine machine, PlayPage page)
        {
            this.machine = machine;
            this.page    = page;

            tiles        = AssetStore.Tiles;
            flyAnimator  = AssetStore.CreateMotherFlyAnimation();
            openAnimator = AssetStore.CreateMotherOpenAnimation();
            tiredMap     = AssetStore.MotherTired;

            healthThresold1 = (int)((double)HEALTH * 0.33d);
            healthThresold2 = (int)((double)HEALTH * 0.66d);

            openAnimator.Stop();

            this.Width  = openAnimator.Width + (2 * 8); // on ajoute les ailes qui dépassent
            this.Height = openAnimator.Height;

            this.InitializeCollision(3, 8, 16 + 3, 3);

            return(this);
        }
Exemple #10
0
        /// <summary>
        /// Start the console
        /// </summary>
        /// <param name="machine"></param>
        /// <returns></returns>

        public override async Task StartAsync(Machine machine)
        {
            this.machine = machine;

            // loading some assets and put them in the video memory of the console
            var assetSprite = AssetSprite.Import(this, "sprite", await LoadContentFile("Game/Sprite.png"));

            this.sprite = this.machine.VideoMemory.CreateSprite(assetSprite);

            // tilesheet is composed of tiles of 8x8 pixels
            // tilesheet is a sprite too

            var assetTileSheet = AssetTileSheet.Import(this, "tilesheet", await LoadContentFile("Game/TileSheet.png"), 8, 8);

            this.tileSheet = this.machine.VideoMemory.CreateTileSheet(assetTileSheet);

            // Read the font file and create an AssetFontSheet
            var assetFont = AssetFontSheet.Import(this, "font", await LoadContentFile("Game/Font.png"), 8, 8, FontTypes.PolychromeStatic);
            // Copy the AssetFontSheet to the VideMemory
            var surfaceFont = machine.VideoMemory.CreateFontSheet(assetFont);

            // Get the mapping of the font based on FontSheet/surfaceFont
            Font font = new Font
            {
                FontSheet = surfaceFont
            };

            font.AddCharacters(CharactersGroups.AlphaUpperAndLower);
            font.AddCharacters(CharactersGroups.Numeric);
            font.AddCharacters(".,\"'?!@*#$%: ");
            font.CharacterIndex += 5;                         // Jump blank characters
            font.AddCharacters("()+-/=©<>~§");                //~ correspond to the save icon (disk), § to the heart icon
            font.UnknownTileNumber = font.GetTileNumber('$'); // by default an unknown character will be represent by a $

            // set the default font of the Screen
            this.machine.Screen.Font = font;

            // create map of a coin
            this.mapCoin = new Map();
            this.mapCoin.Create("mapCoin", 2, 2, tileSheet);
            this.mapCoin.SetTiles(110, 111, 120, 121);

            // create map of the slice of a coin
            this.mapCoinSlice = new Map();
            this.mapCoinSlice.Create("mapCoinSlice", 2, 2, tileSheet);
            this.mapCoinSlice.SetTiles(112, 113, 122, 123);

            // animator
            this.animatorCoin = new Animator();
            this.animatorCoin.Initialize(
                new MapAnimationFrame(mapCoin, 10),     // change every 10 frames
                new MapAnimationFrame(mapCoinSlice, 10) // change every 10 frames
                );
            // launch the animator
            this.animatorCoin.Play();

            // small screen
            this.smallScreen      = this.machine.VideoMemory.CreateEmptySprite("smallScreen", 50, 50);
            this.smallScreen.Font = font;

            machine.UpdatingCallback = Updating;
            machine.UpdatedCallback  = Updated;
            // Method where the game renders one frame
            machine.DrawCallback = Draw;
        }