Пример #1
0
        public void init()
        {
            loadAssets();

            backbuffer = new Bitmap(Game.CANVAS_WIDTH, Game.CANVAS_HEIGHT, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
            backbufferHandle = Graphics.FromImage(backbuffer);

            player_ship = new spaceship(Game.MAP_HEIGHT/2, Game.MAP_WIDTH/2 , 0, 7, 10, 1, backbufferHandle, "triangleF2.png", 8);

            objects = new List<spaceObject>() ;
            nonCollideableObjects = new List<spaceObject>();
            objects.Add(player_ship);

            spaceClouds clouds = new spaceClouds(backbufferHandle, "cloud.png", 2000, 5);
            nonCollideableObjects.Add( clouds);

            spaceProjectiles projectiles = new spaceProjectiles(backbufferHandle, "projectile.png", 10000, 3);
            objects.Add(projectiles);

            /*generate ref points*/
            List<spaceMarker>  markersList  = new List<spaceMarker>();
            for (int i=0; i < Game.MAP_WIDTH; i += 333 )
            {
                for (int j=0; j < Game.MAP_HEIGHT; j += 333)
                {
                    markersList.Add(new spaceMarker(backbufferHandle,3, i, j));
                }
            }

            /*generate  targets*/
            //but they are MOBILE DUN DUN DUN

            Random rnd = new Random();
            for (int i = 0; i < 3000; i += 500)
            {
                for (int j = 0; j < 3000; j += 500)
                {
                    objects.Add(new spaceTarget(backbufferHandle, i + Game.MAP_WIDTH /2 , j + Game.MAP_HEIGHT / 2, 15, 10, rnd.Next(-10, 10), rnd.Next(-10, 10)));
                }
            }

            mapMaker = new miniMapMaker(objects);

            nonCollideableObjects.Add( new spaceReferencePoints(backbufferHandle,  markersList));

            player_ship.init(clouds,projectiles);

            up = false;
            down = false;
            left = false;
            right = false;
            r = false;

            renderThread = new Thread(new ThreadStart(render));
            renderThread.Start();
        }
Пример #2
0
 public void init(spaceClouds c, spaceProjectiles p)
 {
     clouds = c;
     projectiles = p;
 }