コード例 #1
0
ファイル: World.cs プロジェクト: elracional/Games-Spaceball
        public World(PassObject RESETWORLD)
        {
            ResetWorld = RESETWORLD;

            numKilled = 0;

            nave = new Nave("nave", new Vector2(400, 300), new Vector2(48, 48)); //Inicializacion de mundo y cordeenadas

            GameGlobals.PassProjectile = AddProjectile;                          //funcion para activar pasar proyectil como objeto por medio de global  (Delegade)
            GameGlobals.PassMob        = AddMob;                                 //funcion para activar pasar mob como objeto por medio de global  (Delegade)
            offset = new Vector2(0, 0);

            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(50, 50), new Vector2(30, 35)));                         //spawn de naves enemigas
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth / 2, 50), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(500);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 50), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(1000);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 200), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(1500);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(55, 200), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(2000);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 350), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(3500);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(55, 350), new Vector2(30, 35)));
            spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(3000);
            spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth / 2, 410), new Vector2(30, 35)));
            // spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(500);

            ui = new UI();
        }
コード例 #2
0
        public virtual void AI(Nave NAVE)
        {
            pos += Globals.RadialMovement(NAVE.pos, pos, speed); //funcion para que las naves vayan hacia a l nave
            rot  = Globals.RotateTowards(pos, NAVE.pos);

            if (Globals.GetDistance(pos, NAVE.pos) < 15)
            {
                NAVE.GetHit(1);
                dead = true;
            }
        }
コード例 #3
0
 public virtual void Update(Vector2 OFFSET, Nave NAVE)
 {
     AI(NAVE);
     base.Update(OFFSET);
 }