Esempio n. 1
0
        protected override void LoadContent()
        {
            playcountS = 0;
            font       = Content.Load <SpriteFont>("Fonts\\Fuente");
            puntosC    = 0;
            puntosS    = 0;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            j1          = new Paleta(Content);
            j2          = new Paleta(Content);
            bola        = new Bola(Content);
            server      = new Server("192.168.52.56", 8888);
            server.comenzarServidor();
            conversacion = new Thread(new ThreadStart(envRec));
            conversacion.Start();

            serialport = new SerialPort();
            String portname = "";

            foreach (string name in SerialPort.GetPortNames())
            {
                portname = name;
            }
            serialport.PortName = portname;
            serialport.BaudRate = 9600;
            serialport.Parity   = Parity.None;
            serialport.DataBits = 8;
            serialport.Open();
            serialport.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPortRecibir);

            ConvSerial = new Thread(new ThreadStart(parseSerialData));
            ConvSerial.Start();
            musica = Content.Load <Song>("Sounds\\HyperspaceBonusRight");
            MediaPlayer.IsRepeating = true;

            background = Content.Load <Texture2D>("Sprites\\bgRight");

            cursor = new Cursor[101];
            for (int i = 1; i <= 100; i++)
            {
                cursor[i] = new Cursor(Content);
            }



            // TODO: use this.Content to load your game content here
        }
Esempio n. 2
0
        public void update(Vector2 pos,Bola bola,bool mine) {
            posicion = pos;
            rect.X = (int)posicion.X;
            rect.Y = (int)posicion.Y-(rect.Height/2);
            if (colisiono > 0)
            {
                colisiono -= 1;
            }
            else
            {

                if (rect.Intersects(bola.rect))
                {
                    

                    bola.direccion.Y = (posicion.Y - bola.posicion.Y)/18;



                    if (Math.Abs(bola.direccion.X) < 40.0f)
                    {
                        bola.direccion.X *= -1.5f;
                    }
                    else {
                        bola.direccion.X *= -1.0f;
                    }
                    colisiono = 10;
                    if (mine)
                    {
                        bola.effect1 = 1.0f;
                        soundEffectHit.Play();
                    }
                }

            }
            if (bola.posicion.X > 1280) {
                if (murio == 0)
                {
                    soundEffectLose.Play(0.5f, 1.0f, 0.0f);
                    murio = 50;
                }
            }
            if (murio > 0) {
                murio--;
            }

        }
Esempio n. 3
0
        public void update(Vector2 pos, Bola bola, bool mine)
        {
            posicion = pos;
            rect.X   = (int)posicion.X;
            rect.Y   = (int)posicion.Y - (rect.Height / 2);
            if (colisiono > 0)
            {
                colisiono -= 1;
            }
            else
            {
                if (rect.Intersects(bola.rect))
                {
                    bola.direccion.Y = (posicion.Y - bola.posicion.Y) / 18;



                    if (Math.Abs(bola.direccion.X) < 40.0f)
                    {
                        bola.direccion.X *= -1.5f;
                    }
                    else
                    {
                        bola.direccion.X *= -1.0f;
                    }
                    colisiono = 10;
                    if (mine)
                    {
                        bola.effect1 = 1.0f;
                        soundEffectHit.Play();
                    }
                }
            }
            if (bola.posicion.X > 1280)
            {
                if (murio == 0)
                {
                    soundEffectLose.Play(0.5f, 1.0f, 0.0f);
                    murio = 50;
                }
            }
            if (murio > 0)
            {
                murio--;
            }
        }
Esempio n. 4
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            j1 = new Paleta(Content);
            j2 = new Paleta(Content);
            bola = new Bola(Content);
            
            server = new Server("192.168.52.27", 8888);
            server.comenzarServidor();

            conversacion = new Thread(new ThreadStart(envRec));
            conversacion.Start();
            
            

            // TODO: use this.Content to load your game content here
        }
Esempio n. 5
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            j1          = new Paleta(Content);
            j2          = new Paleta(Content);
            bola        = new Bola(Content);

            server = new Server("192.168.52.27", 8888);
            server.comenzarServidor();

            conversacion = new Thread(new ThreadStart(envRec));
            conversacion.Start();



            // TODO: use this.Content to load your game content here
        }
Esempio n. 6
0
 public void update(Vector2 pos, Bola bola)
 {
     posicion = pos;
     rect.X   = (int)posicion.X;
     rect.Y   = (int)posicion.Y;
     if (colisiono > 0)
     {
         colisiono -= 1;
     }
     else
     {
         if (rect.Intersects(bola.rect))
         {
             bola.direccion.X *= -1.3f;
             colisiono         = 10;
         }
     }
 }
Esempio n. 7
0
        public void update(Vector2 pos,Bola bola) {
            posicion = pos;
            rect.X = (int)posicion.X;
            rect.Y = (int)posicion.Y;
            if (colisiono > 0)
            {
                colisiono -= 1;
            }
            else
            {

                if (rect.Intersects(bola.rect))
                {
                    bola.direccion.X *= -1.3f;
                    colisiono = 10;

                }
            }


        }
Esempio n. 8
0
        protected override void LoadContent()
        {
            playcountS = 0;
            font = Content.Load<SpriteFont>("Fonts\\Fuente");
            puntosC = 0;
            puntosS = 0;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            j1 = new Paleta(Content);
            j2 = new Paleta(Content);
            bola = new Bola(Content);
            server = new Server("192.168.52.56", 8888);
            server.comenzarServidor();
            conversacion = new Thread(new ThreadStart(envRec));
            conversacion.Start();

            serialport = new SerialPort();
            String portname = "";
            foreach (string name in SerialPort.GetPortNames())
            {
                portname = name;                
            }
            serialport.PortName = portname;
            serialport.BaudRate = 9600;
            serialport.Parity = Parity.None;
            serialport.DataBits = 8;
            serialport.Open();
            serialport.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPortRecibir);

            ConvSerial = new Thread(new ThreadStart(parseSerialData));
            ConvSerial.Start();
            musica = Content.Load<Song>("Sounds\\HyperspaceBonusRight");
            MediaPlayer.IsRepeating = true;

            background = Content.Load<Texture2D>("Sprites\\bgRight");

            cursor = new Cursor[101];
            for (int i = 1; i <= 100; i++)
            {
                cursor[i] = new Cursor(Content);
            }
                     
         

            // TODO: use this.Content to load your game content here
        }