Exemplo n.º 1
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     Level.Init(Content.Load <Texture2D>("tile"));
     p = new ProgressionHandler(30, 50, 5, 1000);
     graphics.PreferredBackBufferWidth  = Level.windowWidth;
     graphics.PreferredBackBufferHeight = Level.windowHeight;
     graphics.ApplyChanges();
     sf        = Content.Load <SpriteFont>("font12");
     levelText = new Text(sf, "Level: " + p.Level, Color.Black, new Point(10, Level.windowHeight - 100), 2.5f, Vector2.Zero);
     scoreText = new Text(sf, "Score: " + p.Score.ToString() + "/" + p.MaxScoreForLevel, Color.Black, new Point(10, Level.windowHeight - 50), 1.5f, Vector2.Zero);
     holdText  = new Text(sf, "Hold", Color.Black, new Point(Level.hOrigin.X + 100, 25), 3.0f, null);
     nextText  = new Text(sf, "Next Tile", Color.Black, new Point(Level.nOriginX, 25), 3.0f, null);
 }
Exemplo n.º 2
0
        public void Update(ProgressionHandler p, int clearDelay)
        {
            if (!LinesAreBeingCleared)
            {
                for (int y = 0; y < tiles[0].Length; y++)
                {
                    bool lineFull = true;
                    for (int x = 0; x < tiles.Length; x++)
                    {
                        if (tiles[x][y].Color == Level.voidColor)
                        {
                            lineFull = false;
                            break;
                        }
                    }
                    if (lineFull)
                    {
                        LinesAreBeingCleared = true;
                        yClearIndices.Add(y);
                    }
                }
            }

            if (clearCounter >= clearDelay && LinesAreBeingCleared)
            {
                clearCounter = 0;
                for (int i = 0; i < yClearIndices.Count; i++)
                {
                    SetTile(xClearIndex, yClearIndices[i], new Color(100, 100, 100, 255));
                }
                xClearIndex++;
                if (xClearIndex >= tiles.Length)
                {
                    xClearIndex = 0;
                    for (int i = 0; i < yClearIndices.Count; i++)
                    {
                        ClearLine(yClearIndices[i]);
                    }
                    LinesAreBeingCleared = false;
                    yClearIndices.Clear();
                }
            }
            clearCounter++;
        }
Exemplo n.º 3
0
        public static void Update(ProgressionHandler p)
        {
            if (!map.LinesAreBeingCleared)
            {
                if (p.UpdateReady)
                {
                    currentEntity.MoveY(1);
                }

                if (currentEntity.DeadOnArrival)
                {
                    Environment.Exit(1337);
                }
                if (currentEntity.Dead)
                {
                    PushEntities();
                    hToggled = false;
                }
            }

            map.Update(p, 5);
        }