Example #1
0
 public void BeginGame()
 {
     AsteroidGenerator.GenerateAsteroid(35, false);
 }
Example #2
0
 public void DrawScene()
 {
     star.Draw();
     AsteroidGenerator.DrawAsteroids();
     spaceShip.Dibujar();
 }
Example #3
0
        public void Dibujar()
        {
            if (vidas > 0)
            {
                switch (Main.Moviendo)
                {
                case 1:
                {
                    if (p.x < 3)
                    {
                        p.x += 0.08f;
                    }
                    break;
                }

                case -1:
                {
                    if (p.x > -3)
                    {
                        p.x -= 0.08f;
                    }
                    break;
                }

                case 2:
                {
                    if (p.y < 3)
                    {
                        p.y += 0.08f;
                    }
                    break;
                }

                case -2:
                {
                    if (p.y > -3)
                    {
                        p.y -= 0.08f;
                    }
                    break;
                }

                default:
                    break;
                }

                count++;
                if (count == compare)
                {
                    if (compare == 25)
                    {
                        compare = 10;
                    }
                    Position wingLeft  = new Position(this.p.x - 1f, this.p.y, this.p.z);
                    Position wingRight = new Position(this.p.x + 1f, this.p.y, this.p.z);
                    if (AsteroidGenerator.CheckCollision(this.p, 1.1f))
                    {
                        RestarVida();
                    }
                    else
                    if (AsteroidGenerator.CheckCollision(wingRight, 1.1f))
                    {
                        RestarVida();
                    }
                    else
                    if (AsteroidGenerator.CheckCollision(wingLeft, 1.1f))
                    {
                        RestarVida();
                    }
                    count = 0;
                }


                Gl.glPushMatrix();
                Gl.glTranslatef(p.x, p.y, p.z);
                Gl.glScalef(0.3f, 0.3f, 0.3f);
                m.DrawWithTextures();
                Gl.glPopMatrix();
                Gl.glDisable(Gl.GL_TEXTURE_2D);
            }
        }
Example #4
0
 public void ResetGame()
 {
     AsteroidGenerator.GenerateAsteroid(35, true);
     spaceShip.Reiniciar();
 }