elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Jason's MP3 v2.5.1 YouTube mp3 mp4 Downloader C# en: 25 Marzo 2016, 20:58 pm
Hola gente, a pedido del publico o mejor dicho de elektro les traigo una versión recién salida del horno de Jason.

Mejoras:
             ° Descarga audio en Mp3 y videos en Mp4.
             ° Nueva función Reproducir & Descargar (escuchas y a la vez descargas, solo con audios)
             ° Reproductor multimedia integrado
             ° Chat ¿?
             ° Configuraciones
             ° Vista previa mientras se descarga. (solo audio)







Descarga portable,  proyecto y codigo fuente

(tienen que descomprimir en archivos de programa y usar arrancador o ejecutar Jason21.exe como administrador.)
2  Programación / .NET (C#, VB.NET, ASP) / Jason's ogg 2.1 YouTube Downloader C# en: 17 Marzo 2016, 05:24 am
Buenas, les traigo un mini proyecto en fase de pruebas para que lo chequeen.
Jason es un downloader de audio de Youtube, tambien organiza y lista las canciones permitiendo cambiar su ubicacion, calidad, nombre, etc.

Esta programado en C# y utiliza la libreria DevExpress. Para funcionar requiere "Microsoft .Net Framework" y cualquier reproductor OGG. (yo recomiendo VLC)  .






NOTA: Jason no crackea ni proporciona audio/video protegido por derechos de autor (los mismos son bloqueados)

Links descargas:
(proyecto visual studio, portable y  ejecutabbe)




el que quiera participar del proyecto lo puede hacer aca: http://foro.code-makers.es/viewtopic.php?f=21&t=65   ;-)


Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Web;
  11. using System.Net;
  12. using System.IO;
  13. using System.Diagnostics;
  14. using System.Text.RegularExpressions;
  15. using System.Media;
  16. using System.Globalization;
  17.  
  18. namespace Jason21
  19. {
  20.    public partial class Form1 : Form
  21.    {
  22.        List<string> Canciones = new List<string>();
  23.        List<string> urlCanciones = new List<string>();
  24.        List<string> mArchivos = new List<string>();
  25.        public bool PrimerCheck = true;
  26.        public string input;
  27.        public string[] parts1;
  28.        public string[] parts2;
  29.        public string[] parts3;
  30.        public string Titulo;
  31.        public string[] ImgP;
  32.        public string[] ImgTP;
  33.        public string[] ImgTP2;
  34.        public string[] ImgT;
  35.        public string[] videoID;
  36.  
  37.        // v1.1 Reformas
  38.        public int intentoDescarga;
  39.        public int maxIntentos;
  40.        public string ultimaURL;
  41.        public int uU = 0;
  42.  
  43.        // v2.0 Reformas
  44.        public string urlADS;
  45.  
  46.        //v2.1 Reformas
  47.        public string archivo_Configuracion;
  48.        public string CarpetaDescargas;
  49.        public float megaBytesGlobal;
  50.        public int sDescargas = 0;
  51.        public bool Cancelar_Busqueda = false;
  52.        public string ultimaPestana = "controlBuscar";
  53.        public int tDescargas = 0;
  54.        public int fDescargas = 0;
  55.        public Form1()
  56.        {
  57.            InitializeComponent();
  58.            webBrowser1.ScriptErrorsSuppressed = true;
  59.            webBrowser2.ScriptErrorsSuppressed = true;
  60.            listBox1.MouseDoubleClick += new MouseEventHandler(listBox1_DoubleClick);
  61.            lista_Biblioteca.MouseDoubleClick += new MouseEventHandler(lista_Biblioteca_DoubleClick);
  62.            // Control_Pestanas.SelectedPageChanged += new TabControlCancelEventHandler(Control_Pestanas_Selecting);
  63.  
  64.        }
  65.  
  66.        private void Form1_Load(object sender, EventArgs e)
  67.        {
  68.            archivo_Configuracion = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\JasonConfig.config");
  69.            CheckConfig();
  70.            ListarCanciones();
  71.            intentoDescarga = 2;
  72.            boton_CancelarBusqueda.Enabled = false;
  73.            Application.DoEvents();
  74.            ListarCanciones();
  75.            Application.DoEvents();
  76.            webBrowser2.Navigate("http://jason.esy.es/");
  77.        }
  78.  
  79.  
  80.  
  81.  
  82.  
  83.        private void boton_Buscar_Click(object sender, EventArgs e)
  84.        {
  85.            boton_Buscar.Enabled = false;
  86.            boton_CancelarBusqueda.Enabled = true;
  87.            Canciones.Clear();
  88.            urlCanciones.Clear();
  89.            listBox1.Items.Clear();
  90.            Cancelar_Busqueda = false;
  91.            for (int i = 1; i <= (int)input_pagBusqueda.Value; i++)
  92.            {
  93.                if (Cancelar_Busqueda)
  94.                {
  95.                    i = 100;
  96.                }
  97.                else
  98.                {
  99.                    Buscar_Agregar(inputText_Buscar.Text, i);
  100.                }
  101.            }
  102.        }
  103.  
  104.        public void Buscar_Agregar(string Busqueda, int Pagina)
  105.        {
  106.            Control_Pestanas.SelectedPageIndex= 0;
  107.            webBrowser1.Navigate("https://www.youtube.com/results?search_query=" + Busqueda + "&page=" + Pagina);
  108.            while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
  109.            {
  110.                Application.DoEvents();
  111.            }
  112.            HtmlElementCollection theElementCollection = default(HtmlElementCollection);
  113.            theElementCollection = webBrowser1.Document.GetElementsByTagName("a");
  114.            foreach (HtmlElement curElement in theElementCollection)
  115.            {
  116.                if (curElement.GetAttribute("classname") == "yt-uix-sessionlink yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2       spf-link ")
  117.                {
  118.                    bool esLista = curElement.GetAttribute("href").Contains("list");
  119.                    if (!esLista)
  120.                    {
  121.                        listBox1.Items.Add(curElement.GetAttribute("InnerText"));
  122.                        urlCanciones.Add(curElement.GetAttribute("href"));
  123.                    }
  124.                }
  125.            }
  126.        }
  127.  
  128.        private void boton_CancelarBusqueda_Click(object sender, EventArgs e)
  129.        {
  130.            boton_CancelarBusqueda.Enabled = false;
  131.            boton_Buscar.Enabled = true;
  132.            Cancelar_Busqueda = true;
  133.        }
  134.  
  135.  
  136.        private void listBox1_DoubleClick(object sender, MouseEventArgs e)
  137.        {
  138.            if (sDescargas <= 3)
  139.            {
  140.                ConvertirCancion(sender, e);
  141.            }
  142.            else
  143.            {
  144.                MessageBox.Show("The free version does not allow many downloads.");
  145.            }
  146.        }
  147.        public void ConvertirCancion(object sender, MouseEventArgs e)
  148.        {
  149.            int index = this.listBox1.IndexFromPoint(e.Location);
  150.            int urlB = listBox1.SelectedIndex;
  151.            label_ArchivosDescargados.Text = tDescargas.ToString();
  152.            if (index != System.Windows.Forms.ListBox.NoMatches)
  153.            {
  154.                tabControl1.SelectedIndex = 1;
  155.                lista_Descargas.Items.Add(listBox1.SelectedItem);
  156.                label_EstadoDescarga.Text = "It becoming! please, be patient...";
  157.                label_LocacionDescarga.Text = urlCanciones[urlB];
  158.                webBrowser1.Navigate(urlCanciones[listBox1.SelectedIndex]);
  159.                while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
  160.                {
  161.                    Application.DoEvents();
  162.                }
  163.                try
  164.                {
  165.                    input = webBrowser1.DocumentText;
  166.                    parts1 = input.Split(new string[] { "type=audio" }, StringSplitOptions.None);
  167.                    maxIntentos = parts1.Count();
  168.                    parts2 = parts1[intentoDescarga].Split(new string[] { "url=" }, StringSplitOptions.None);
  169.                    parts3 = parts2[1].Split(new string[] { "\\" }, StringSplitOptions.None);
  170.                    Titulo = webBrowser1.Document.Title.Replace(" - YouTube", "");
  171.                    label_EstadoDescarga.Text = "Successful conversion";
  172.                    label_NombreDescarga.Text = Titulo + ".ogg";
  173.                    videoID = urlCanciones[listBox1.SelectedIndex].Split(new string[] { "=" }, StringSplitOptions.None);
  174.                    webBrowser1.Navigate("about:blank");
  175.                    Application.DoEvents();
  176.                    DescargarCancion();
  177.                }
  178.                catch
  179.                {
  180.                    fDescargas ++;
  181.                    label_DescargasFallidas.Text = fDescargas.ToString();
  182.                    label_EstadoDescarga.Text = "Error becoming  file - try again later.";
  183.                    label_NombreDescarga.Text = Titulo + ".ogg\"";
  184.                    webBrowser1.Navigate("about:blank");
  185.                }
  186.            }
  187.        }
  188.  
  189.        public void DescargarCancion()
  190.        {
  191.            label_EstadoDescarga.Text = "Downloading...";
  192.            WebClient Client = new WebClient();
  193.            Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
  194.            Client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
  195.            Client.DownloadFileAsync(new Uri((HttpUtility.UrlDecode(parts3[0]))), (CarpetaDescargas + "/" + Titulo + ".ogg").Replace("?", ""));
  196.            Application.DoEvents();
  197.            sDescargas++;
  198.        }
  199.  
  200.        public void FalloDescarga()
  201.        {
  202.            fDescargas++;
  203.            sDescargas--;
  204.            label_DescargasFallidas.Text = fDescargas.ToString();
  205.            label_NombreDescarga.Text = intentoDescarga.ToString() + " - Error : \"" + Titulo + ".ogg\"  is protected by copyright.";
  206.            File.Delete(CarpetaDescargas + "/" + Titulo + ".ogg");
  207.            Application.DoEvents();
  208.            /* System.Threading.Thread.Sleep(2000);
  209.             this.intentoDescarga += 1;
  210.             if (intentoDescarga > 1)
  211.             {
  212.                 ConvertirCancion(null, null);
  213.             }
  214.             if (intentoDescarga > maxIntentos - 2)
  215.             {
  216.                 intentoDescarga = 1;
  217.             }
  218.             */
  219.        }
  220.        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
  221.        {
  222.            int Porciento = ((int)e.BytesReceived * 100) / ((int)e.TotalBytesToReceive);
  223.            label_ArchivosDescargando.Text = sDescargas.ToString();
  224.            try
  225.            {
  226.                progressBar1.Maximum = (int)e.TotalBytesToReceive / 100;
  227.                progressBar1.Value = (int)e.BytesReceived / 100;
  228.                double megaBytesT = ((double)e.TotalBytesToReceive / 1024) / (1024);
  229.                double megaBytesR = ((double)e.BytesReceived / 1024) / (1024);
  230.            }
  231.            catch
  232.            {
  233.                label_EstadoDescarga.Text = " Downloading - " + Titulo;
  234.            }
  235.  
  236.            try
  237.            {
  238.  
  239.                progressBar1.Maximum = (int)e.TotalBytesToReceive / 100;
  240.                progressBar1.Value = (int)e.BytesReceived / 100;
  241.                double megaBytesT = ((double)e.TotalBytesToReceive / 1024) / (1024);
  242.                megaBytesGlobal = (float)megaBytesT;
  243.                double megaBytesR = ((double)e.BytesReceived / 1024) / (1024);
  244.                if (megaBytesT <= (float)0.5)
  245.                {
  246.                    FalloDescarga();
  247.                }
  248.                else
  249.                {
  250.                    label_EstadoDescarga.Text = " Downloading  " + Porciento + " %";
  251.                    label_MBr.Text = megaBytesR.ToString().Substring(0, 4) + "Mb.";
  252.                    label_MBt.Text = megaBytesT.ToString().Substring(0, 4) + "Mb.";
  253.                }
  254.            }
  255.            catch
  256.            {
  257.                Application.DoEvents();
  258.            }
  259.        }
  260.  
  261.        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  262.        {
  263.  
  264.            if (e.Error != null)
  265.            {
  266.                FalloDescarga();
  267.            }
  268.            else
  269.            {
  270.                string Cancion = CarpetaDescargas + "\\" + Titulo + ".ogg";
  271.                if (megaBytesGlobal <= (float)0.5)
  272.                {
  273.                    label_EstadoDescarga.Text = "Unknow error";
  274.                }
  275.                else
  276.                {
  277.                    sDescargas--;
  278.                    tDescargas++;
  279.                    label_ArchivosDescargando.Text = sDescargas.ToString();
  280.                    label_ArchivosDescargados.Text = tDescargas.ToString();
  281.                    label_EstadoDescarga.Text = "Download completed";
  282.                }
  283.  
  284.                if (checkBox_AbrirFinal.Checked)
  285.                {
  286.                    Process.Start(CarpetaDescargas); //, string.Format("/select,\"{0}\"", Titulo + ".ogg"));
  287.                    Application.DoEvents();
  288.                    SendKeys.Send(Titulo);
  289.                }
  290.  
  291.  
  292.                if (checkBox_PlayFinal.Checked)
  293.                {
  294.  
  295.                    Process.Start(Cancion);
  296.                    Application.DoEvents();
  297.                }
  298.            }
  299.        }
  300.  
  301.        public void ListarCanciones()
  302.        {
  303.            if (!PrimerCheck)
  304.            {
  305.                mArchivos.Clear();
  306.                lista_Biblioteca.Items.Clear();
  307.            }
  308.            string[] archivos = Directory.GetFiles(CarpetaDescargas, "*.*", SearchOption.TopDirectoryOnly);
  309.            if (archivos.Length >= 1)
  310.            {
  311.                foreach (string nombre in archivos)
  312.                {
  313.                    bool esOGG = nombre.Contains(".ogg");
  314.                    bool esMP3 = nombre.Contains(".mp3");
  315.                    bool filtro = nombre.ToLower().Contains(textBox_Library_Filter.Text.ToLower());
  316.                    if (esOGG && filtro || esMP3 && filtro)
  317.                    {
  318.  
  319.                        mArchivos.Add(nombre);
  320.                        lista_Biblioteca.Items.Add(nombre.Replace(CarpetaDescargas + "\\", "") + "                                    -                                  Location:  " + nombre);
  321.  
  322.                    }
  323.                }
  324.            }
  325.            PrimerCheck = false;
  326.        }
  327.  
  328.        public void CheckConfig()
  329.        {
  330.            bool abrirFinal = archivo_Configuracion.Contains("openonfinish=true");
  331.            bool playFinal = archivo_Configuracion.Contains("playonfinish=true");
  332.            bool usarMyMusic = archivo_Configuracion.Contains("usemymusic=true");
  333.            if (abrirFinal)
  334.            {
  335.                usar_MyMusic.Checked = true;
  336.            }
  337.            else
  338.            {
  339.                usar_MyMusic.Checked = false;
  340.            }
  341.            if (playFinal)
  342.            {
  343.                usar_OtraCarpeta.Checked = true;
  344.            }
  345.            else
  346.            {
  347.                usar_OtraCarpeta.Checked = false;
  348.            }
  349.            if (usarMyMusic)
  350.            {
  351.                usar_MyMusic.Checked = true;
  352.                usar_OtraCarpeta.Checked = false;
  353.                elegir_Carpeta.Enabled = false;
  354.                CarpetaDescargas = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  355.                textBox_PathChoice.Text = CarpetaDescargas;
  356.                textBox_PathChoice.Enabled = false;
  357.            }
  358.            else if (!usarMyMusic)
  359.            {
  360.                usar_MyMusic.Checked = false;
  361.                usar_OtraCarpeta.Checked = true;
  362.                elegir_Carpeta.Enabled = true;
  363.                CarpetaDescargas = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\Downpath.config");
  364.                textBox_PathChoice.Text = CarpetaDescargas;
  365.            }
  366.        }
  367.  
  368.  
  369.  
  370.        // FIN FIN FIN FIN
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.        private void checkEdit8_CheckedChanged(object sender, EventArgs e)
  388.        {
  389.  
  390.        }
  391.  
  392.        private void groupControl4_Paint(object sender, PaintEventArgs e)
  393.        {
  394.  
  395.        }
  396.  
  397.        private void comboBox_Filter_Library_type_SelectedIndexChanged(object sender, EventArgs e)
  398.        {
  399.  
  400.        }
  401.  
  402.        private void checkBox_AbrirFinal_CheckedChanged(object sender, EventArgs e)
  403.        {
  404.            if (checkBox_AbrirFinal.Checked)
  405.            {
  406.                archivo_Configuracion = archivo_Configuracion.Replace("openonfinish=false", "openonfinish=true");
  407.            }
  408.            else if (!checkBox_AbrirFinal.Checked)
  409.            {
  410.                archivo_Configuracion = archivo_Configuracion.Replace("openonfinish=true", "openonfinish=false");
  411.            }
  412.        }
  413.  
  414.        private void checkBox_PlayFinal_CheckedChanged(object sender, EventArgs e)
  415.        {
  416.            if (checkBox_PlayFinal.Checked)
  417.            {
  418.                archivo_Configuracion = archivo_Configuracion.Replace("playonfinish=false", "playonfinish=true");
  419.            }
  420.            else if (!checkBox_PlayFinal.Checked)
  421.            {
  422.                archivo_Configuracion = archivo_Configuracion.Replace("playonfinish=true", "playonfinish=false");
  423.            }
  424.        }
  425.  
  426.        private void usar_MyMusic_CheckedChanged(object sender, EventArgs e)
  427.        {
  428.            if (usar_MyMusic.Checked && archivo_Configuracion.Contains("usemymusic=false"))
  429.            {
  430.                archivo_Configuracion = archivo_Configuracion.Replace("usemymusic=false", "usemymusic=true");
  431.                usar_OtraCarpeta.Checked = false;
  432.                textBox_PathChoice.Enabled = false;
  433.                elegir_Carpeta.Enabled = false;
  434.                CarpetaDescargas = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  435.                textBox_PathChoice.Text = CarpetaDescargas;
  436.                using (StreamWriter ArchivoDownpath = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\Downpath.config"))
  437.                {
  438.                    ArchivoDownpath.Write("");
  439.                }
  440.            }
  441.        }
  442.  
  443.        private void usar_OtraCarpeta_CheckedChanged(object sender, EventArgs e)
  444.        {
  445.            if (usar_OtraCarpeta.Checked && archivo_Configuracion.Contains("usemymusic=true"))
  446.            {
  447.                archivo_Configuracion = archivo_Configuracion.Replace("usemymusic=true", "usemymusic=false");
  448.                usar_MyMusic.Checked = false;
  449.                textBox_PathChoice.Enabled = true;
  450.                elegir_Carpeta.Enabled = true;
  451.            }
  452.        }
  453.  
  454.        private void boton_AplicarConfig_Click(object sender, EventArgs e)
  455.        {
  456.            using (StreamWriter ArchivoConfig = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\JasonConfig.config"))
  457.            {
  458.                ArchivoConfig.Write(archivo_Configuracion);
  459.            }
  460.            if (usar_MyMusic.Checked)
  461.            {
  462.                Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  463.            }
  464.            else
  465.            {
  466.                CarpetaDescargas = textBox_PathChoice.Text;
  467.            }
  468.            //continuar
  469.            using (StreamWriter ArchivoDownpath = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\Downpath.config"))
  470.            {
  471.                ArchivoDownpath.Write(CarpetaDescargas);
  472.            }
  473.        }
  474.  
  475.        private void boton_Reset_Click(object sender, EventArgs e)
  476.        {
  477.            using (StreamWriter ArchivoConfig = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\JasonConfig.config"))
  478.            {
  479.                ArchivoConfig.Write("openonfinish=true;playonfinish=false;usemymusic=true;otherpath:();");
  480.                archivo_Configuracion = ("openonfinish=true;playonfinish=false;usemymusic=true;otherpath:();");
  481.                CarpetaDescargas = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  482.            }
  483.  
  484.            CheckConfig();
  485.  
  486.            using (StreamWriter ArchivoDownpath = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Jason\Downpath.config"))
  487.            {
  488.                ArchivoDownpath.Write("");
  489.            }
  490.        }
  491.  
  492.        private void elegir_Carpeta_Click(object sender, EventArgs e)
  493.        {
  494.            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  495.            {
  496.                textBox_PathChoice.Text = folderBrowserDialog1.SelectedPath;
  497.            }
  498.        }
  499.  
  500.        private void simpleButton3_Click(object sender, EventArgs e)
  501.        {
  502.            lista_Descargas.CheckedItems.OfType<string>().ToList().ForEach(lista_Descargas.Items.Remove);
  503.        }
  504.  
  505.        private void simpleButton4_Click(object sender, EventArgs e)
  506.        {
  507.            lista_Descargas.Items.Clear();
  508.        }
  509.  
  510.        private void link_AbrirCarpeta_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  511.        {
  512.            Process.Start(CarpetaDescargas);
  513.        }
  514.  
  515.  
  516.        private void lista_Biblioteca_DoubleClick(object sender, EventArgs e)
  517.        {
  518.            try {
  519.                Process.Start(mArchivos[lista_Biblioteca.SelectedIndex]);
  520.            } catch
  521.            {
  522.                Process.Start(mArchivos[lista_Biblioteca.SelectedIndex]);
  523.            }
  524.        }
  525.        private void lista_Descargas_DoubleClick(object sender, EventArgs e)
  526.        {
  527.            try
  528.            {
  529.                textBox_Library_Filter.Text = lista_Biblioteca.SelectedItem.ToString();
  530.            }
  531.            catch
  532.            {
  533.                textBox_Library_Filter.Text = lista_Biblioteca.SelectedItem.ToString();
  534.            }
  535.        }
  536.  
  537.  
  538.        private void textBox_Library_Filter_TextChanged(object sender, EventArgs e)
  539.        {
  540.            ListarCanciones();
  541.        }
  542.  
  543.        private void control_Biblioteca_Paint(object sender, PaintEventArgs e)
  544.        {
  545.            // ListarCanciones();
  546.            if (ultimaPestana != "controlBiblioteca")
  547.            {
  548.                ListarCanciones();
  549.            } else
  550.            {
  551.                Application.DoEvents();
  552.            }
  553.  
  554.        }
  555.  
  556.        private void lista_Biblioteca_SelectedIndexChanged(object sender, EventArgs e)
  557.        {
  558.  
  559.        }
  560.  
  561.        private void label13_Click(object sender, EventArgs e)
  562.        {
  563.  
  564.        }
  565.  
  566.        private void lista_Descargas_SelectedIndexChanged(object sender, EventArgs e)
  567.        {
  568.  
  569.        }
  570.    }
  571. }
  572.  



Bueno, eso es todo! Saludos
3  Programación / Scripting / Invasion Espacial 2.0 en VBScript [VBS + HTA] 100% Notepad! en: 28 Mayo 2014, 05:49 am
Buenas. Hoy aburrido tome una idea antigua en mi cabeza con los restos de un intento de juego y quedo esto:



No le puse sonido y es muy simple. tambien es un regalo para mi hermana menor.
les dejo el codido..

Código
  1.  
  2. <HTA:APPLICATION
  3. ID = "SI2"
  4. APPLICATIONNAME="SpaceInvaders2"
  5. BORDER = "Thin"
  6. CAPTION = "Yes"
  7. RESIZE = "No"
  8. ICON = "icono.ico"
  9. SHOWINTASKBAR = "Yes"
  10. SINGLEINSTANCE = "Yes"
  11. SYSMENU = "Yes"
  12. WINDOWSTATE = "Normal"
  13. SCROLL = "No"
  14. SCROLLFLAT = "No"
  15. VERSION = "1.0"
  16. INNERBORDER = "Yes"
  17. SELECTION = "No"
  18. MAXIMIZEBUTTON = "No"
  19. MINIMIZEBUTTON = "Yes"
  20. NAVIGABLE = "Yes"
  21. CONTEXTMENU = "Yes"
  22. BORDERSTYLE = "Normal"></HTA>
  23. <HTML>
  24.      <TITLE>Space Invaders 2.0</TITLE>
  25.  <HEAD>
  26.  </HEAD>
  27.  <BODY BackGround="fondo.png" TopMargin="0" LeftMargin="0">
  28.  <INPUT TYPE="Hidden" ID="TeclaA">
  29.  <INPUT TYPE="Hidden" ID="TeclaW">
  30.  <INPUT TYPE="Hidden" ID="TeclaD">
  31.  <INPUT TYPE="Hidden" ID="TeclaS">
  32.  <INPUT TYPE="Hidden" ID="TeclaEspacio">
  33.  <INPUT TYPE="Hidden" ID="TeclaEnter">
  34.  <INPUT TYPE="Hidden" ID="TeclaEsc">
  35.  <INPUT TYPE="Hidden" ID="EstadoJuego">
  36.  <INPUT TYPE="Hidden" ID="Disparo">
  37.  <DIV ID="Pantalla">PRESS ENTER</DIV>
  38.  <IMG ID="Jugador">
  39.  <IMG ID="OvniUno">
  40.  <IMG ID="OvniDos">
  41.  <IMG ID="OvniTres">
  42.  <IMG ID="OvniCuatro">
  43.  <IMG ID="OvniCinco">
  44.  <IMG ID="MisilUno">
  45.  </BODY>
  46. </HTML>
  47. <SCRIPT LANGUAGE="VBScript">
  48. Sub Window_OnLoad()
  49. REM Creado por JohnConnor
  50. REM Lobos, Buenos Aires - Argentina
  51. REM Martes 28 Mayo 2014
  52. REM CM | Code Makers NO MURIO!
  53. REM www.fb.me/John1Connor
  54. REM john1connor@facebook.com
  55. Self.ResizeTo 800,600
  56. Self.MoveTo ((Screen.Width - 800) / 2), ((Screen.Height - 600) / 2)
  57. Jugador.Src = "ju.png"
  58. Jugador.Style.Width = 50
  59. Jugador.Style.Height = 50
  60. Jugador.Style.Position = "Absolute"
  61. Jugador.Style.Top = 500
  62. Jugador.Style.Left = 750 / 2
  63. TeclaA.Value = "False"
  64. TeclaW.Value = "False"
  65. TeclaD.Value = "False"
  66. TeclaS.Value = "False"
  67. TeclaEspacio.Value = "False"
  68. TeclaEnter.Value = "False"
  69. TeclaEsc.Value = "False"
  70. Pantalla.Style.Position = "Absolute"
  71. Pantalla.Style.Width = 300
  72. Pantalla.Style.Height = 100
  73. Pantalla.Style.Top = 270
  74. Pantalla.Style.Left = 270
  75. Pantalla.Style.Color = "Lime"
  76. Pantalla.Style.FontSize = "30"
  77.  
  78. OvniUno.Style.Top = Int((300 - 10 + (Random / 2)) * Rnd + 10)
  79. OvniDos.Style.Top = Int((300 - 10 + (Random / 2)) * Rnd + 10)
  80. OvniTres.Style.Top = Int((300 - 10 + (Random / 2)) * Rnd + 10)
  81. OvniCuatro.Style.Top = Int((300 - 10 + (Random / 2)) * Rnd + 10)
  82. OvniCinco.Style.Top = Int((300 - 10 + (Random / 2)) * Rnd + 10)
  83.  
  84. OvniUno.Src = "ovni.gif"
  85. OvniDos.Src = "ovni.gif"
  86. OvniTres.Src = "ovni.gif"
  87. OvniCuatro.Src = "ovni.gif"
  88. OvniCinco.Src = "ovni.gif"
  89.  
  90. MisilUno.Style.Top = 999
  91. MisilUno.Style.Left = 900
  92. MisilUno.Style.Width = cInt(15)
  93. MisilUno.Style.Height = 40
  94. MisilUno.Src = "misil.gif"
  95. MisilUno.Style.zIndex = -2
  96.  
  97. OvniUno.Style.Width = 55
  98. OvniUno.Style.Left = Int((100 - 10 + (Random / 2)) * Rnd + 10)
  99. OvniDos.Style.Left = Int((100 - 10 + (Random / 2)) * Rnd + 10)
  100. OvniTres.Style.Left = Int((100 - 10 + (Random / 2)) * Rnd + 10)
  101. OvniCuatro.Style.Left = Int((100 - 10 + (Random / 2)) * Rnd + 10)
  102. OvniCinco.Style.Left = Int((100 - 10 + (Random / 2)) * Rnd + 10)
  103. OvniDos.Style.Width = 55
  104. OvniTres.Style.Width = 55
  105. OvniCuatro.Style.Width = 55
  106. OvniCinco.Style.Width = 55
  107. OvniUno.Style.Height = 33
  108. OvniDos.Style.Height = 33
  109. OvniTres.Style.Height = 33
  110. OvniCuatro.Style.Height = 33
  111. OvniCinco.Style.Height = 33
  112. OvniUno.Style.Position = "Absolute"
  113. OvniUno.Title = "Vivo"
  114. OvniDos.Title = "Vivo"
  115. OvniTres.Title = "Vivo"
  116. OvniCuatro.Title = "Vivo"
  117. OvniCinco.Title = "Vivo"
  118.  
  119. OvniDos.Style.Position = "Absolute"
  120. OvniTres.Style.Position = "Absolute"
  121. OvniCuatro.Style.Position = "Absolute"
  122. OvniCinco.Style.Position = "Absolute"
  123. MisilUno.Style.Position = "Absolute"
  124. Disparo.Value = "OFF"
  125.  
  126. EstadoJuego.Value = "NoIniciado"
  127. Tiempo = Window.SetInterval("Ciclo()",0) : ClearInterval Tiempo
  128. End Sub
  129.  
  130. Sub Document_OnKeyPress
  131. IF EstadoJuego.Value = "Iniciado" And Window.Event.KeyCode = "13"  Then
  132. ClearInterval Tiempo
  133. Pausar()
  134. End If
  135.  
  136. If Window.Event.KeyCode = "13" And EstadoJuego.Value = "NoIniciado" Then : Iniciar(): End If
  137. If Window.Event.KeyCode = "27" Then : TeclaEsc.Value = "True" : End If
  138. If Window.Event.KeyCode = "13" Then : TeclaEnter.Value = "True" : End If
  139. If Window.Event.KeyCode = "32" Then : TeclaEspacio.Value = "True" : End If
  140. If Window.Event.KeyCode = "119" Then : TeclaW.Value = "True" : End If
  141. If Window.Event.KeyCode = "115" Then : TeclaS.Value = "True" : End If
  142. If Window.Event.KeyCode = "97" Then : TeclaA.Value = "True" : End If
  143. If Window.Event.KeyCode = "100" Then : TeclaD.Value = "True" : End If
  144. End Sub
  145.  
  146. Sub Document_OnKeyUp
  147. If Window.Event.KeyCode = "27" Then : TeclaEsc.Value = "False" : End If
  148. If Window.Event.KeyCode = "13" Then : TeclaEnter.Value = "False" : End If
  149. If Window.Event.KeyCode = "32" Then : TeclaEspacio.Value = "False" : End If
  150. If Window.Event.KeyCode = "87" Then : TeclaW.Value = "False" : End If
  151. If Window.Event.KeyCode = "83" Then : TeclaS.Value = "False" :  End If
  152. If Window.Event.KeyCode = "65" Then : TeclaA.Value = "False" : End If
  153. If Window.Event.KeyCode = "68" Then : TeclaD.Value = "False" : End If
  154. End Sub
  155.  
  156. Sub Iniciar()
  157. EstadoJuego.Value = "Iniciado" : Tiempo = Window.SetInterval("Ciclo()",1) : Pantalla.InnerHTML = ""
  158. End Sub
  159. Sub Pausar()
  160. EstadoJuego.Value = "Pausado" : ClearInterval Tiempo : Pantalla.InnerHTML = "Paused"
  161. End Sub
  162.  
  163. Sub Ciclo()
  164. If EstadoJuego.Value = "NoIniciado" Then : Msgbox "Error de ejecución" & Chr(13) & "FATAL RUN",16,"ERROR" : Self.Close : End If
  165. If EstadoJuego.Value = "Perdido" Then : Exit Sub : End If
  166. If TeclaW.Value = "True" Then : Call MoverV("-2") : End If
  167. If TeclaS.Value = "True" Then : Call MoverV("+2") : End If
  168. If TeclaA.Value = "True" Then : Call MoverH("-2") : End If
  169. If TeclaD.Value = "True" Then : Call MoverH("+2") : End If
  170. If TeclaEspacio.Value = "True" Then : Call Disparar() : End If
  171. If Disparo.Value = "ON" Then : MisilUno.Style.Top = Limpiar(MisilUno.Style.Top) - (cInt(2)) : End If
  172. If Limpiar(MisilUno.Style.Top) < (0) Then : Disparo.Value = "OFF" : MisilUno.Style.Top = cInt(900) : END IF
  173.  
  174.  
  175. If OvniUno.Title = "Vivo" And Coliciones(Limpiar(Jugador.Style.Left), Limpiar(Jugador.Style.WIdth) - 10, Limpiar(Jugador.Style.Top), Limpiar(Jugador.Style.Height) - 10,Limpiar(OvniUno.Style.Left), Limpiar(OvniUno.Style.Height) - 10, Limpiar(OvniUno.Style.Top), Limpiar(OvniUno.Style.WIdth) - 10) = "True" Then : Call Perdiste() : End If
  176. If OvniDos.Title = "Vivo" And Coliciones(Limpiar(Jugador.Style.Left), Limpiar(Jugador.Style.WIdth) - 10, Limpiar(Jugador.Style.Top), Limpiar(Jugador.Style.Height) - 10,Limpiar(OvniDos.Style.Left), Limpiar(OvniDos.Style.Height) - 10, Limpiar(OvniDos.Style.Top), Limpiar(OvniDos.Style.WIdth) - 10) = "True" Then : Call Perdiste() : End If
  177. If OvniTres.Title = "Vivo" And  Coliciones(Limpiar(Jugador.Style.Left), Limpiar(Jugador.Style.WIdth) - 10, Limpiar(Jugador.Style.Top), Limpiar(Jugador.Style.Height) - 10,Limpiar(OvniTres.Style.Left), Limpiar(OvniTres.Style.Height) - 10, Limpiar(OvniTres.Style.Top), Limpiar(OvniTres.Style.WIdth) - 10) = "True" Then : Call Perdiste() : End If
  178. If OvniCuatro.Title = "Vivo" And Coliciones(Limpiar(Jugador.Style.Left), Limpiar(Jugador.Style.WIdth) - 10, Limpiar(Jugador.Style.Top), Limpiar(Jugador.Style.Height) - 10,Limpiar(OvniCuatro.Style.Left), Limpiar(OvniCuatro.Style.Height) - 10, Limpiar(OvniCuatro.Style.Top), Limpiar(OvniCuatro.Style.WIdth) - 10) = "True" Then : Call Perdiste() : End If
  179. If OvniCinco.Title = "Vivo" And  Coliciones(Limpiar(Jugador.Style.Left), Limpiar(Jugador.Style.WIdth) - 10, Limpiar(Jugador.Style.Top), Limpiar(Jugador.Style.Height) - 10,Limpiar(OvniCinco.Style.Left), Limpiar(OvniCinco.Style.Height) - 10, Limpiar(OvniCinco.Style.Top), Limpiar(OvniCinco.Style.WIdth) - 10) = "True" Then : Call Perdiste() : End If
  180.  
  181. If Coliciones(Limpiar(MisilUno.Style.Left), Limpiar(MisilUno.Style.Width) , Limpiar(MisilUno.Style.Top), Limpiar(MisilUno.Style.Height), Limpiar(OvniUno.Style.Left), Limpiar(OvniUno.Style.Height), Limpiar(OvniUno.Style.Top), Limpiar(OvniUno.Style.Width)) = "True" Then
  182. OvniUno.Src = "explocion.gif" : OvniUno.Title = "Muerto" : Call RestaurarMisil() : TimeOff = Window.SetTimeOut("ChauOvniUno()",1000)
  183. End If
  184. If Coliciones(Limpiar(MisilUno.Style.Left), Limpiar(MisilUno.Style.Width) , Limpiar(MisilUno.Style.Top), Limpiar(MisilUno.Style.Height), Limpiar(OvniDos.Style.Left), Limpiar(OvniDos.Style.Height), Limpiar(OvniDos.Style.Top), Limpiar(OvniDos.Style.Width)) = "True" Then
  185. OvniDos.Src = "explocion.gif" : OvniDos.Title = "Muerto" : Call RestaurarMisil() : TimeOff = Window.SetTimeOut("ChauOvniDos()",1000)
  186. End If
  187. If Coliciones(Limpiar(MisilUno.Style.Left), Limpiar(MisilUno.Style.Width) , Limpiar(MisilUno.Style.Top), Limpiar(MisilUno.Style.Height), Limpiar(OvniTres.Style.Left), Limpiar(OvniTres.Style.Height), Limpiar(OvniTres.Style.Top), Limpiar(OvniTres.Style.Width)) = "True" Then
  188. OvniTres.Src = "explocion.gif" : OvniTres.Title = "Muerto" : Call RestaurarMisil() : TimeOff = Window.SetTimeOut("ChauOvniTres()",1000)
  189. End If
  190. If Coliciones(Limpiar(MisilUno.Style.Left), Limpiar(MisilUno.Style.Width) , Limpiar(MisilUno.Style.Top), Limpiar(MisilUno.Style.Height), Limpiar(OvniCuatro.Style.Left), Limpiar(OvniCuatro.Style.Height), Limpiar(OvniCuatro.Style.Top), Limpiar(OvniCuatro.Style.Width)) = "True" Then
  191. OvniCuatro.Src = "explocion.gif" : OvniCuatro.Title = "Muerto" : Call RestaurarMisil() : TimeOff = Window.SetTimeOut("ChauOvniCuatro()",1000)
  192. End If
  193. If Coliciones(Limpiar(MisilUno.Style.Left), Limpiar(MisilUno.Style.Width) , Limpiar(MisilUno.Style.Top), Limpiar(MisilUno.Style.Height), Limpiar(OvniCinco.Style.Left), Limpiar(OvniCinco.Style.Height), Limpiar(OvniCinco.Style.Top), Limpiar(OvniCinco.Style.Width)) = "True" Then
  194. OvniCinco.Src = "explocion.gif" : OvniCinco.Title = "Muerto" : Call RestaurarMisil() : TimeOff = Window.SetTimeOut("ChauOvniCinco()",1000)
  195. End If
  196.  
  197. If OvniUno.Title = "Muerto" And OvniDos.Title = "Muerto" And OvniTres.Title = "Muerto" And OvniCuatro.Title = "Muerto" And OvniCinco.Title = "Muerto" Then
  198. Pantalla.InnerHTML = "GANASTE!"
  199. End If
  200.  
  201. Call IA()
  202. End Sub
  203.  
  204. Sub ChauOvniUno()
  205. OvniUno.Style.Top = 9999
  206. End Sub
  207. Sub ChauOvniDos()
  208. OvniDos.Style.Top = 9999
  209. End Sub
  210. Sub ChauOvniTres()
  211. OvniTres.Style.Top = 9999
  212. End Sub
  213. Sub ChauOvniCuatro()
  214. OvniCuatro.Style.Top = 9999
  215. End Sub
  216. Sub ChauOvniCinco()
  217. OvniCinco.Style.Top = 9999
  218. End Sub
  219.  
  220.  
  221. Sub Perdida()
  222. Jugador.Src = "vacio.png"
  223. End Sub
  224. Sub Perdiste
  225. EstadoJuego.Value = "Perdido" : Jugador.Src = "explocion.gif" : TimeOff = Window.SetTimeOut("Perdida()",1000) : Pantalla.InnerHtml = "GAME OVER! <br> Powered By JohnConnor"
  226. End Sub
  227.  
  228.  
  229. Sub RestaurarMisil()
  230. Disparo.Value = "OFF" : MisilUno.Style.Top = 999
  231. End Sub
  232.  
  233.  
  234. Sub MoverV(nro)
  235. Jugador.Style.Top = cInt(Limpiar(Jugador.Style.Top)) + cInt(nro)
  236. End Sub
  237. Sub MoverH(nro)
  238. Jugador.Style.Left = cInt(Limpiar(Jugador.Style.Left)) + cInt(nro)
  239. End Sub
  240.  
  241. Sub Disparar()
  242. If Disparo.Value = "OFF" Or Limpiar(MisilUno.Style.Top) < (-30) Then
  243. MisilUno.Style.Top = Jugador.Style.Top : MisilUno.Style.Left = Limpiar(Jugador.Style.Left) + 15
  244. Disparo.Value = "ON"
  245. End If
  246. End Sub
  247.  
  248.  
  249. Sub IA()
  250. If OvniUno.Title = "Vivo" Then
  251. If Limpiar(OvniUno.Style.Top) >= Limpiar(Jugador.Style.Top) Then : OvniUno.Style.Top = Limpiar(OvniUno.Style.Top) - cInt(1) : End If
  252. If Limpiar(OvniUno.Style.Top) =< Limpiar(Jugador.Style.Top) Then : OvniUno.Style.Top = Limpiar(OvniUno.Style.Top) + cInt(1) : End If
  253. If Limpiar(OvniUno.Style.Left) =< Limpiar(Jugador.Style.Left) Then : OvniUno.Style.Left = (Limpiar(OvniUno.Style.Left) + cInt(1)) : End If
  254. If Limpiar(OvniUno.Style.Left) >= Limpiar(Jugador.Style.Left) Then : OvniUno.Style.Left = (Limpiar(OvniUno.Style.Left) - cInt(1)) : End If
  255. End If
  256.  
  257. If OvniDos.Title = "Vivo" Then
  258. If Limpiar(OvniDos.Style.Top) >= Limpiar(Jugador.Style.Top) Then : OvniDos.Style.Top = Limpiar(OvniDos.Style.Top) - cInt(1) : End If
  259. If Limpiar(OvniDos.Style.Top) =< Limpiar(Jugador.Style.Top) Then : OvniDos.Style.Top = Limpiar(OvniDos.Style.Top) + cInt(1) : End If
  260. If Limpiar(OvniDos.Style.Left) =< Limpiar(Jugador.Style.Left) Then : OvniDos.Style.Left = (Limpiar(OvniDos.Style.Left) + cInt(1)) : End If
  261. If Limpiar(OvniDos.Style.Left) >= Limpiar(Jugador.Style.Left) Then : OvniDos.Style.Left = (Limpiar(OvniDos.Style.Left) - cInt(1)) : End If
  262. End If
  263.  
  264. If OvniTres.Title = "Vivo" Then
  265. If Limpiar(OvniTres.Style.Top) >= Limpiar(Jugador.Style.Top) Then : OvniTres.Style.Top = Limpiar(OvniTres.Style.Top) - cInt(1) : End If
  266. If Limpiar(OvniTres.Style.Top) =< Limpiar(Jugador.Style.Top) Then : OvniTres.Style.Top = Limpiar(OvniTres.Style.Top) + cInt(1) : End If
  267. If Limpiar(OvniTres.Style.Left) =< Limpiar(Jugador.Style.Left) Then : OvniTres.Style.Left = (Limpiar(OvniTres.Style.Left) + cInt(1)) : End If
  268. If Limpiar(OvniTres.Style.Left) >= Limpiar(Jugador.Style.Left) Then : OvniTres.Style.Left = (Limpiar(OvniTres.Style.Left) - cInt(1)) : End If
  269. End If
  270.  
  271. If OvniCuatro.Title = "Vivo" Then
  272. If Limpiar(OvniCuatro.Style.Top) >= Limpiar(Jugador.Style.Top) Then : OvniCuatro.Style.Top = Limpiar(OvniCuatro.Style.Top) - cInt(1) : End If
  273. If Limpiar(OvniCuatro.Style.Top) =< Limpiar(Jugador.Style.Top) Then : OvniCuatro.Style.Top = Limpiar(OvniCuatro.Style.Top) + cInt(1) : End If
  274. If Limpiar(OvniCuatro.Style.Left) =< Limpiar(Jugador.Style.Left) Then : OvniCuatro.Style.Left = (Limpiar(OvniCuatro.Style.Left) + cInt(1)) : End If
  275. If Limpiar(OvniCuatro.Style.Left) >= Limpiar(Jugador.Style.Left) Then : OvniCuatro.Style.Left = (Limpiar(OvniCuatro.Style.Left) - cInt(1)) : End If
  276. ENd If
  277.  
  278. If OvniCinco.Title = "Vivo" Then
  279. If Limpiar(OvniCinco.Style.Top) >= Limpiar(Jugador.Style.Top) Then : OvniCinco.Style.Top = Limpiar(OvniCinco.Style.Top) - cInt(1) : End If
  280. If Limpiar(OvniCinco.Style.Top) =< Limpiar(Jugador.Style.Top) Then : OvniCinco.Style.Top = Limpiar(OvniCinco.Style.Top) + cInt(1) : End If
  281. If Limpiar(OvniCinco.Style.Left) =< Limpiar(Jugador.Style.Left) Then : OvniCinco.Style.Left = (Limpiar(OvniCinco.Style.Left) + cInt(1)) : End If
  282. If Limpiar(OvniCinco.Style.Left) >= Limpiar(Jugador.Style.Left) Then : OvniCinco.Style.Left = (Limpiar(OvniCinco.Style.Left) - cInt(1)) : End If
  283. End If
  284.  
  285. End Sub
  286.  
  287.  
  288. Function Limpiar(Objeto)
  289. Limpiar = Replace(Objeto,"px","")
  290. End Function
  291.  
  292. Function Coliciones(PosXUno, AnchoUno, PosYUno, LargoUno,PosXDos, LargoDos, PosYDos, AnchoDos)
  293. If  (CInt(PosXUno) + CInt(AnchoUno)) >= (CInt(PosXDos)) And (CInt(PosXUno)) < (CInt(PosXDos) + CInt(AnchoDos)) And (CInt(PosYUno) + CInt(LargoUno)) > (CInt(PosYDos)) And (CInt(PosYUno)) < (CInt(PosYDos) + CInt(AnchoDos)) Then
  294. Coliciones = "True"
  295. Else
  296. Coliciones = "False"
  297. End If
  298. End Function
  299.  
  300. Function Random()
  301. RandomA = Replace(Time,":","")
  302. RandomB = Replace(RandomA,".","")
  303. RandomC = Replace(RandomB,"pm","")
  304. RandomD = Replace(RandomC,"am","")
  305. Random = Mid(RandomD,4)
  306. End Function
  307.  
  308.  
  309. </SCRIPT>
  310.  


Saludos
4  Programación / Scripting / VBScript: Angry Birds Pong in VBScript [HTA + VBS] (100% Notepad) by JohnConnor en: 4 Marzo 2013, 03:02 am
Juego programado en VBScript y HTML (hta) con el Notepad.
by JohnConnor : Facundo Rinaldi 2 Code-Makers.com

Hola gente, les dejo el ultimo juego que hice, es un PONG . en realidad es el mismo que el anterior pero con algunas mejoras y nuevos graficos. Tambien agregue sonidos y publicidades.

Las teclas igual al anterior.

Un video de muestra:

Aca en codigo:

                     
Código
  1. Sub Window_OnLoad
  2. Cargando.Style.Display = "None"
  3. If Screen.Width < 800 or Screen.Height < 600 Then
  4. Msgbox "Error: 0x1028 " & Chr(13) & "Su resolucion de patalla no permite la ejecucion de la aplicacion."
  5. End If
  6. Self.ResizeTo 800,600
  7. Pantalla_De_Juego.Style.Display = "None"
  8. Pantalla_Ganador.Style.Display = "None"
  9. Menu_Principal.Style.Color = "Gray"
  10. Menu_Principal.Style.FontSize = "12"
  11. Menu_Principal.Style.Position = "Absolute"
  12. Menu_Principal.Style.Top = "70"
  13. Menu_Principal.Style.Left = "45"
  14. JugadorUnoP.Style.Position = "Absolute"
  15. JugadorDosP.Style.Position = "Absolute"
  16. JugadorUnoP.Style.fontSize = "50"
  17. JugadorDosP.Style.fontSize = "50"
  18. JugadorUnoP.Style.Top = "10"
  19. JugadorDosP.Style.Top = "10"
  20. JugadorUnoP.Style.Left = 300
  21. JugadorDosP.Style.Left = 500
  22.  
  23. ' --- Configuracion JugadorDos --- *
  24. JugadorUno.Style.Position = "Absolute"
  25. JugadorUno.Style.Width = "60"
  26. JugadorUno.Style.Height = "60"
  27. JugadorUno.Style.Top = "40"
  28. JugadorUno.Style.Left = "10"
  29.  
  30. ' --- Configuracion de JugadorDos --- *
  31. JugadorDos.Style.Position = "Absolute"
  32. JugadorDos.Style.Width = "60"
  33. JugadorDos.Style.Height = "60"
  34. JugadorDos.Style.Top = "90"
  35. JugadorDos.Style.Left = "740"
  36.  
  37.  
  38. ' --- Configuracion de Pelota --- *
  39. Pelota.Style.Position = "Absolute"
  40. Pelota.Style.Width = "30"
  41. Pelota.Style.Height = "30"
  42. Pelota.Style.Top = "100"
  43. Pelota.Style.Left = "100"
  44.  
  45. LD.Style.Position = "Absolute"
  46. LD.Style.Width = "3"
  47. LD.Style.Height = "600"
  48. LD.Style.Left = "400"
  49. LD.Style.Display = "None"
  50.  
  51. VolumenIMG.Style.Position = "Absolute"
  52. VolumenIMG.Style.Bottom = "15"
  53. VolumenIMG.Style.Right = "5"
  54. VolumenIMG.Style.ZIndex = "999"
  55.  
  56. FacebookIMG.Style.Position = "Absolute"
  57. FacebookIMG.Style.Bottom = "16"
  58. FacebookIMG.Style.Left = "5"
  59. FacebookIMG.Style.ZIndex = "999"
  60.  
  61. TwitterIMG.Style.Position = "Absolute"
  62. TwitterIMG.Style.Bottom = "15"
  63. TwitterIMG.Style.Left = "50"
  64. TwitterIMG.Style.ZIndex = "999"
  65.  
  66. Publicidad.Style.Position = "Absolute"
  67. Publicidad.Style.Bottom = "5"
  68. Publicidad.Style.Left = "160"
  69. Publicidad.Style.Width = "468"
  70. Publicidad.Style.Height = "60"
  71. Publicidad.Style.ZIndex = "9999"
  72. Publicidad.Style.OverFlow = "Hidden"
  73.  
  74. PublicidadDos.Style.Position = "Absolute"
  75. PublicidadDos.Style.Top = "170"
  76. PublicidadDos.Style.Left = "110"
  77. PublicidadDos.Style.Width = "300"
  78. PublicidadDos.Style.Height = "250"
  79. PublicidadDos.Style.ZIndex = "9999"
  80. PublicidadDos.Style.OverFlow = "Hidden"
  81.  
  82. FondoGanador.Style.Position = "Absolute"
  83. FondoGanador.Style.Top = "100"
  84. FondoGanador.Style.Left = "70"
  85.  
  86. IMGanador.Style.Position = "Absolute"
  87. IMGanador.Style.Top = "220"
  88. IMGanador.Style.Left = "500"
  89. Imganador.Style.Width = "150"
  90. Imganador.Style.Height = "150"
  91.  
  92. Piso.Style.Position = "Absolute"
  93. Piso.Style.Width = "800"
  94. Piso.Style.Height = "87"
  95. Piso.Style.Bottom = "0"
  96. Piso.Style.BackgroundImage = "Url(Imagenes/Piso.png)"
  97. JugadorUnoPTXT.Value = "0" : JugadorDosPTXT.Value = "0"
  98. JugadorUnoP.InnerHtml = "<img src=""Imagenes/p" & JugadorUnoPTXT.Value & ".png"">" : JugadorDosP.InnerHtml = "<img src=""Imagenes/p" & JugadorDosPTXT.Value & ".png"">"
  99. End Sub
  100.  
  101.  
  102. Sub Document_OnKeyPress
  103.  
  104. If Window.Event.KeyCode = "27" Then : Salir : End If
  105. If Window.Event.KeyCode = "13" Then : Comenzar : Volver : If E.Value = "0" Then : MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/BotonOk.wav""",1)  : Movimiento_Pelota : E.Value = "1" :  End If : End If
  106.  
  107. If Window.Event.KeyCode = "119" Then : JUArriba.Value = "-4" : End If
  108. If Window.Event.KeyCode = "115" Then : JUAbajo.Value = "4" :  End If
  109.  
  110. If Window.Event.KeyCode = "105" Then : JDArriba.Value = "-4" : End If
  111. If Window.Event.KeyCode = "107" Then : JDAbajo.Value = "4" : End If
  112. End Sub
  113.  
  114.  
  115. Sub Document_OnKeyUp
  116. If Window.Event.KeyCode = "87" Or Window.Event.KeyCode = "83" Then : JUArriba.Value = "0" : JUAbajo.Value = "0" : End If
  117. If Window.Event.KeyCode = "73" Or Window.Event.KeyCode = "75" Then : JDArriba.Value = "0" : JDAbajo.Value = "0" : End If
  118. End Sub
  119.  
  120. Sub BotonArrancar_OnMouseOver
  121. MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/BotonArriba.wav""",1)
  122. BotonArrancar.SRC= "Imagenes/startbd.png"
  123. End Sub
  124.  
  125. Sub BotonArrancar_OnMouseOut
  126. If E.Value = "0" Then
  127. MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Menu_Principal.mp3""",1)
  128. BotonArrancar.SRC= "Imagenes/startb.png"
  129. End If
  130. End Sub
  131.  
  132. Sub BotonArrancar_OnClick
  133. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/BotonOk.wav""",1)
  134. Comenzar : Movimiento_Pelota : E.Value = "1"
  135. End Sub
  136.  
  137.  
  138.  
  139. Sub Comenzar
  140. Menu_Principal.Style.Display = "None"
  141. Pantalla_De_Juego.Style.Display = "InLine"
  142. MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/AmbienteJuego.mp3""",400)
  143. SonidosAmbiente.Volume = "0"
  144. End Sub
  145.  
  146. Sub MoverJugadorUno(Mov)
  147. JugadorUno.Style.Top = CInt(Replace(JugadorUno.Style.Top,"px","")) + CInt(Mov)
  148. End Sub
  149.  
  150. Sub MoverJugadorDos(Mov)
  151. JugadorDos.Style.Top = CInt(Replace(JugadorDos.Style.Top,"px","")) + CInt(Mov)
  152. End Sub
  153.  
  154. Sub Movimiento_Pelota
  155.  
  156. If JugadorUnoPTXT.Value > 9 Then
  157. MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Juego_Ganado.mp3""",1)
  158. Pantalla_Ganador.Style.Display = "Inline"
  159. IMGanador.SRC = "Imagenes/JU.png"
  160. Exit Sub
  161. End If
  162.  
  163. If JugadorDosPTXT.Value > 9 Then
  164. MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Juego_Ganado.mp3""",1)
  165. Pantalla_Ganador.Style.Display = "Inline"
  166. IMGanador.SRC = "Imagenes/JD.png"
  167. Exit Sub
  168. End If
  169.  
  170. If Replace(Pelota.Style.Top,"px","") > 463 Then
  171. DireccionPelotaX.Value = CInt(-4)
  172. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Rebotando.wav""",1)
  173. End If
  174. If Replace(Pelota.Style.Top,"px","") < 1 Then
  175. DireccionPelotaX.Value = CInt(+4)
  176. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Rebotando.wav""",1)
  177. End If
  178. If Replace(Pelota.Style.Left,"px","") > 780 Then
  179. Pelota.Style.Left = "760"
  180. DireccionPelotaY.Value = CInt(-4)
  181. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Festejo.wav""",1)
  182. IMGP.SRC = "Imagenes/1.png"
  183. JugadorUnoPTXT.Value = JugadorUnoPTXT.Value + Cint(1)
  184. JugadorUnoP.InnerHtml = "<img src=""Imagenes/p" & JugadorUnoPTXT.Value & ".png"">"
  185. End If
  186. If Replace(Pelota.Style.Left,"px","") < 0 Then
  187. Pelota.Style.Left = "0"
  188. DireccionPelotaY.Value = CInt(+4)
  189. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Festejo.wav""",1)
  190. IMGP.SRC = "Imagenes/0.png"
  191. JugadorDosPTXT.Value = JugadorDosPTXT.Value + Cint(1)
  192. JugadorDosP.InnerHtml = "<img src=""Imagenes/p" & JugadorDosPTXT.Value & ".png"">"
  193. End If
  194. If Coliciones(Replace(JugadorUno.Style.Left,"px",""), Replace(JugadorUno.Style.Width,"px",""), Replace(JugadorUno.Style.Top,"px",""),Replace(JugadorUno.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  195. 'Pelota.Style.BackgroundColor = "Yellow"
  196. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Tiro.wav""",1)
  197. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Volando.wav""",300)
  198.  
  199. DireccionPelotaY.Value = CInt(+ Int((8 - 5 + 1) * RND + 5))
  200. If DireccionPelotaX.Value > 0 Then
  201. DireccionPelotaX.Value = CInt(+ Int((10 - 1 + 1) * RND + 1))
  202. Else
  203. DireccionPelotaX.Value = CInt(- Int((10 - 1 + 1) * RND + 1))
  204. End If
  205. IMGP.SRC = "Imagenes/0.png"
  206. Else
  207. 'Pelota.Style.BackgroundColor = "White"
  208. End If
  209. If Coliciones(Replace(JugadorDos.Style.Left,"px",""), Replace(JugadorDos.Style.Width,"px",""), Replace(JugadorDos.Style.Top,"px",""),Replace(JugadorDos.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  210. 'Pelota.Style.BackgroundColor = "Yellow"
  211. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Tiro.wav""",1)
  212. MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/PajaroVolando.wav""",300)
  213. DireccionPelotaY.Value = CInt(- Int((8 - 5 + 1) * RND + 5))
  214. If DireccionPelotaX.Value < 0 Then
  215. DireccionPelotaX.Value = CInt(- Int((10 - 1 + 1) * RND + 1))
  216. Else
  217. DireccionPelotaX.Value = CInt(+ Int((10 - 1 + 1) * RND + 1))
  218. End If
  219. IMGP.SRC = "Imagenes/1.png"
  220. Else
  221. 'Pelota.Style.BackgroundColor = "White"
  222. End If
  223.  
  224. Pelota.Style.Top = Cint(Replace(Pelota.Style.Top,"px","")) + Cint(DireccionPelotaX.Value)
  225. Pelota.Style.Left = Cint(Replace(Pelota.Style.Left,"px","")) + Cint(DireccionPelotaY.Value)
  226.  
  227. If Replace(JugadorUno.Style.Top,"px","") < 2 Then : JugadorUno.Style.Top = 2 : End If
  228. If Replace(JugadorUno.Style.Top,"px","") > 433 Then : JugadorUno.Style.Top = 433 : End If
  229.  
  230. If Replace(JugadorDos.Style.Top,"px","") < 2 Then : JugadorDos.Style.Top = 2 : End If
  231. If Replace(JugadorDos.Style.Top,"px","") > 433 Then : JugadorDos.Style.Top = 433 : End If
  232.  
  233. MoverJugadorUno(JUArriba.value) :  MoverJugadorDos(JDArriba.value)  : MoverJugadorUno(JUAbajo.Value) : MoverJugadorDos(JDAbajo.Value)
  234.  
  235. MP = Window.SetTimeOut("Movimiento_Pelota",1)
  236. End Sub
  237.  
  238. Function Coliciones(x1, width1, y1, height1,x2, width2, y2, height2)
  239. If  (CInt(x1) + CInt(width1)) > (CInt(x2)) and (CInt(x1)) < (CInt(x2) + CInt(width2)) And (CInt(y1) + CInt(height1)) > (CInt(y2)) and (CInt(y1)) < (CInt(y2) + CInt(height2)) Then
  240. Coliciones = "Verdadero"
  241. Else
  242. Coliciones = "Falso"
  243. End If
  244. End Function
  245.  
  246. Sub IniMSJPre
  247. If IniMSJV.Value = "A" then
  248. Ini_MSJ.Style.Display = "None"
  249. IniMSJV.Value = "B"
  250. Else
  251. Ini_MSJ.Style.Display = "Inline"
  252. IniMSJV.Value = "A"
  253. End If
  254. End Sub
  255.  
  256. Sub Salir
  257. Set WshShell = CreateObject("WScript.Shell")
  258. Return = WshShell.Run("http://angrybirds.hol.es/pong/Comparte.php", 1,False)
  259. Self.Close
  260. End Sub
  261.  
  262. Sub TwitterIMG_OnMouseOver
  263. TwitterIMG.SRC = "Imagenes/Twitter0.png"
  264. End Sub
  265.  
  266. Sub FacebookIMG_OnMouseOver
  267. FacebookIMG.SRC = "Imagenes/Facebook0.png"
  268. End Sub
  269.  
  270. Sub TwitterIMG_OnMouseOut
  271. TwitterIMG.SRC = "Imagenes/Twitter1.png"
  272. End Sub
  273.  
  274. Sub FacebookIMG_OnMouseOut
  275. FacebookIMG.SRC = "Imagenes/Facebook1.png"
  276. End Sub
  277.  
  278. Sub TwitterIMG_OnClick
  279. Set WshShell = CreateObject("WScript.Shell")
  280. Return = WshShell.Run("http://www.twitter.com/AngryBirdsPong", 1,False)
  281. End Sub
  282.  
  283. Sub FacebookIMG_OnClick
  284. Set WshShell = CreateObject("WScript.Shell")
  285. Return = WshShell.Run("http://fb.me/AngryBirdsPong", 1,False)
  286. End Sub
  287.  
  288. Sub VolumenIMG_OnMouseOver
  289. VolumenIMG.SRC = "Imagenes/Volumen1.png"
  290. End Sub
  291.  
  292. Sub VolumenIMG_OnMouseOut
  293. VolumenIMG.SRC = "Imagenes/Volumen0.png"
  294. End Sub
  295.  
  296. Sub VolumenIMG_OnClick
  297. If Vol.Value = "si" then
  298. SonidosAmbiente.Volume = "-10000"
  299. SonidosJuego.Volume = "-10000"
  300. Vol.Value = "no"
  301. Else
  302. SonidosAmbiente.Volume = "0"
  303. SonidosJuego.Volume = "0"
  304. Vol.Value = "si"
  305. End If
  306. End Sub
  307.  
  308. Sub Volver
  309. Set WshShell = CreateObject("WScript.Shell")
  310. If JugadorUnoPTXT.Value > 9 or JugadorDosPTXT.value > 9 Then
  311. Return = WshShell.Run("VolverAJugar.vbs", 1, False)
  312. Self.Close
  313. End If
  314. End Sub
  315.  

FUENTE: FORO CODE-MAKERS

http://www.twitter.com/FTRinaldi
http://www.Facebook.com/John1Connor
http://foro.code-makers.com
5  Programación / Scripting / PONG Game - Simple Juego "Pong" [VBScript + HTA] (100% Notepad) en: 22 Febrero 2013, 19:07 pm
Pong Game en VBScript y HTA (Juego VBS)


Hola foreros, les traigo una versión simple Script de VB del juego PONG escrita 100% con Bloc de Notas.

           Teclas:  
                          W = Jugador 1 (Arriba)
                          S = Jugador 1 (Abajo)
                          I = Jugador 2  (Arriba)
                          K = Jugador 2 (Abajo)
          



Link de Descarga (Mediafire) ----> http://www.mediafire.com/?tz80qo23lgz194l

Y aca el codigo:
                          
Código
  1. <Title>Pong VBScript by JohnConnor</Title>
  2. <HTA:APPLICATION
  3. ID = "PONGVBS"
  4. APPLICATIONNAME="Pong Game in VBScript"
  5. BORDER = "Dialog"
  6. CAPTION = "Yes"
  7. RESIZE = "no"
  8. ICON = "icono.ico"
  9. SHOWINTASKBAR = "No"
  10. SINGLEINSTANCE = "Yes"
  11. SYSMENU = "No"
  12. WINDOWSTATE = "normal"
  13. SCROLL = "no"
  14. SCROLLFLAT = "no"
  15. VERSION = "1.0"
  16. INNERBORDER = "no"
  17. SELECTION = "yes"
  18. MAXIMIZEBUTTON = "no"
  19. MINIMIZEBUTTON = "no"
  20. NAVIGABLE = "yes"
  21. CONTEXTMENU = "yes"
  22. BORDERSTYLE = "normal"></HTA>
  23. <BODY TOPMARGIN="0" LEFTMARGIN="0" BGColor="Black">
  24. <DIV ID="Menu_Principal" Style="">Pong Game VBScript<DIV ID="Ini_MSJ" Style="Display: InLine;">Pulse (ENTER) para comenzar.</DIV></DIV>
  25. <DIV ID="Pantalla_De_Juego" Width="100%" Height="100%">
  26. <DIV ID="JugadorUno"  Style="Background-Color: White;">0</DIV>
  27. <DIV ID="JugadorDos"  Style="Background-Color: White;">0</DIV>
  28. <DIV ID="Pelota" Style="Background-Color: White;"></DIV>
  29. </DIV>
  30. <Input Type="Hidden" ID="IniMSJV" Value="A">
  31. <Input Type="Hidden" ID="DireccionPelotaX" Value="1">
  32. <Input Type="Hidden" ID="DireccionPelotaY" Value="1">
  33. </BODY>
  34. <Script Language="VBScript">
  35. Sub Window_OnLoad
  36. Self.ResizeTo 350,250
  37. Pantalla_De_Juego.Style.Display = "None"
  38. Menu_Principal.Style.Color = "White"
  39. Menu_Principal.Style.FontSize = "30"
  40. Menu_Principal.Style.Position = "Absolute"
  41. Menu_Principal.Style.Top = "70"
  42. Menu_Principal.Style.Left = "45"
  43. Ini_MSJ.Style.FontSize = "12"
  44. Ini_MSJ.Style.Position = "Absolute"
  45. Ini_MSJ.Style.Top = "80"
  46. Ini_MSJ.Style.Left = "60"
  47. IniMSJ = Window.SetInterval("IniMSJPre",700)
  48.  
  49. ' --- Configuracion JugadorDos --- *
  50. JugadorUno.Style.Position = "Absolute"
  51. JugadorUno.Style.Width = "15"
  52. JugadorUno.Style.Height = "60"
  53. JugadorUno.Style.Top = "40"
  54. JugadorUno.Style.Left = "10"
  55.  
  56. ' --- Configuracion de JugadorDos --- *
  57. JugadorDos.Style.Position = "Absolute"
  58. JugadorDos.Style.Width = "15"
  59. JugadorDos.Style.Height = "60"
  60. JugadorDos.Style.Top = "90"
  61. JugadorDos.Style.Left = "320"
  62. IniMSJ = Window.SetInterval("IniMSJPre",700)
  63.  
  64. ' --- Configuracion de Pelota --- *
  65. Pelota.Style.Position = "Absolute"
  66. Pelota.Style.Width = "15"
  67. Pelota.Style.Height = "10"
  68. Pelota.Style.Top = "100"
  69. Pelota.Style.Left = "100"
  70. End Sub
  71.  
  72. Sub Document_OnKeyPress
  73. If Window.Event.KeyCode = "27" Then : Self.Close : End If
  74. If Window.Event.KeyCode = "13" Then : Comenzar : Movimiento_Pelota() : End If
  75.  
  76. If Window.Event.KeyCode = "119" Then : MoverJugadorUno(-5) : End If
  77. If Window.Event.KeyCode = "115" Then : MoverJugadorUno(5) : End If
  78.  
  79. If Window.Event.KeyCode = "105" Then : MoverJugadorDos(-5) : End If
  80. If Window.Event.KeyCode = "107" Then : MoverJugadorDos(5) : End If
  81. End Sub
  82.  
  83. Sub Comenzar
  84. Menu_Principal.Style.Display = "None"
  85. Pantalla_De_Juego.Style.Display = "InLine"
  86. End Sub
  87.  
  88. Sub MoverJugadorUno(Mov)
  89. JugadorUno.Style.Top = CInt(Replace(JugadorUno.Style.Top,"px","")) + CInt(Mov)
  90. End Sub
  91.  
  92. Sub MoverJugadorDos(Mov)
  93. JugadorDos.Style.Top = CInt(Replace(JugadorDos.Style.Top,"px","")) + CInt(Mov)
  94. End Sub
  95.  
  96. Sub Movimiento_Pelota
  97.  
  98. If Replace(Pelota.Style.Top,"px","") > 200 Then
  99. DireccionPelotaX.Value = CInt(-1)
  100. End If
  101. If Replace(Pelota.Style.Top,"px","") < 1 Then
  102. DireccionPelotaX.Value = CInt(+1)
  103. End If
  104. If Replace(Pelota.Style.Left,"px","") > 330 Then
  105. DireccionPelotaY.Value = CInt(-1)
  106. JugadorUno.InnerHtml = JugadorUno.InnerHtml + CInt(1)
  107. End If
  108. If Replace(Pelota.Style.Left,"px","") < 0 Then
  109. DireccionPelotaY.Value = CInt(+1)
  110. JugadorDos.InnerHtml = JugadorDos.InnerHtml + CInt(1)
  111. End If
  112. If Coliciones(Replace(JugadorUno.Style.Left,"px",""), Replace(JugadorUno.Style.Width,"px",""), Replace(JugadorUno.Style.Top,"px","")+2,Replace(JugadorUno.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  113. Pelota.Style.BackgroundColor = "Yellow"
  114. DireccionPelotaY.Value = CInt(+1)
  115. Else
  116. Pelota.Style.BackgroundColor = "White"
  117. End If
  118. If Coliciones(Replace(JugadorDos.Style.Left,"px",""), Replace(JugadorDos.Style.Width,"px",""), Replace(JugadorDos.Style.Top,"px","")+2,Replace(JugadorDos.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  119. Pelota.Style.BackgroundColor = "Yellow"
  120. DireccionPelotaY.Value = CInt(-1)
  121. Else
  122. Pelota.Style.BackgroundColor = "White"
  123. End If
  124.  
  125. Pelota.Style.Top = Cint(Replace(Pelota.Style.Top,"px","")) + Cint(DireccionPelotaX.Value)
  126. Pelota.Style.Left = Cint(Replace(Pelota.Style.Left,"px","")) + Cint(DireccionPelotaY.Value)
  127. MP = Window.SetTimeOut("Movimiento_Pelota",1)
  128. End Sub
  129.  
  130. Function Coliciones(x1, width1, y1, height1,x2, width2, y2, height2)
  131. If  (CInt(x1) + CInt(width1)) > (CInt(x2)) and (CInt(x1)) < (CInt(x2) + CInt(width2)) And (CInt(y1) + CInt(height1)) > (CInt(y2)) and (CInt(y1)) < (CInt(y2) + CInt(height2)) Then
  132. Coliciones = "Verdadero"
  133. Else
  134. Coliciones = "Falso"
  135. End If
  136. End Function
  137.  
  138. Sub IniMSJPre
  139. If IniMSJV.Value = "A" then
  140. Ini_MSJ.Style.Display = "None"
  141. IniMSJV.Value = "B"
  142. Else
  143. Ini_MSJ.Style.Display = "Inline"
  144. IniMSJV.Value = "A"
  145. End If
  146. End Sub
  147. </Script>
  148.  
  149.  

He modificado un poco el codigo, tiene mejoras en los eventos del teclado, tambien corrijo problemas de puntuacion y le agregue mas velocidad y mas pantalla de juego. por lo demas es igual. aca dejo el code pero solo el VBSCript
Código
  1. Sub Window_OnLoad
  2. Self.ResizeTo 450,350
  3. Pantalla_De_Juego.Style.Display = "None"
  4. Menu_Principal.Style.Color = "White"
  5. Menu_Principal.Style.FontSize = "30"
  6. Menu_Principal.Style.Position = "Absolute"
  7. Menu_Principal.Style.Top = "70"
  8. Menu_Principal.Style.Left = "45"
  9. Ini_MSJ.Style.FontSize = "12"
  10. Ini_MSJ.Style.Position = "Absolute"
  11. Ini_MSJ.Style.Top = "80"
  12. Ini_MSJ.Style.Left = "60"
  13. IniMSJ = Window.SetInterval("IniMSJPre",700)
  14. JugadorUnoP.Style.Position = "Absolute"
  15. JugadorDosP.Style.Position = "Absolute"
  16. JugadorUnoP.Style.fontSize = "24"
  17. JugadorDosP.Style.fontSize = "24"
  18. JugadorUnoP.Style.Bottom = "10"
  19. JugadorDosP.Style.Bottom = "10"
  20. JugadorUnoP.Style.Left = 225 - 30
  21. JugadorDosP.Style.Left = 225 + 20
  22.  
  23. ' --- Configuracion JugadorDos --- *
  24. JugadorUno.Style.Position = "Absolute"
  25. JugadorUno.Style.Width = "15"
  26. JugadorUno.Style.Height = "60"
  27. JugadorUno.Style.Top = "40"
  28. JugadorUno.Style.Left = "10"
  29.  
  30. ' --- Configuracion de JugadorDos --- *
  31. JugadorDos.Style.Position = "Absolute"
  32. JugadorDos.Style.Width = "15"
  33. JugadorDos.Style.Height = "60"
  34. JugadorDos.Style.Top = "90"
  35. JugadorDos.Style.Left = "420"
  36. IniMSJ = Window.SetInterval("IniMSJPre",700)
  37.  
  38. ' --- Configuracion de Pelota --- *
  39. Pelota.Style.Position = "Absolute"
  40. Pelota.Style.Width = "15"
  41. Pelota.Style.Height = "10"
  42. Pelota.Style.Top = "100"
  43. Pelota.Style.Left = "100"
  44.  
  45. LD.Style.Position = "Absolute"
  46. LD.Style.Width = "3"
  47. LD.Style.Height = "500"
  48. LD.Style.Left = "225"
  49. End Sub
  50.  
  51.  
  52. Sub Document_OnKeyPress
  53. If Window.Event.KeyCode = "27" Then : Self.Close : End If
  54. If Window.Event.KeyCode = "13" Then : Comenzar : If E.Value = "0" Then : Movimiento_Pelota : E.Value = "1" : End If : End If
  55.  
  56. If Window.Event.KeyCode = "119" Then : JUArriba.Value = "-8" : End If
  57. If Window.Event.KeyCode = "115" Then : JUAbajo.Value = "8" : End If
  58.  
  59. If Window.Event.KeyCode = "105" Then : JDArriba.Value = "-8" : End If
  60. If Window.Event.KeyCode = "107" Then : JDAbajo.Value = "8" : End If
  61. End Sub
  62.  
  63.  
  64. Sub Document_OnKeyUp
  65. If Window.Event.KeyCode = "87" Or Window.Event.KeyCode = "83" Then : JUArriba.Value = "0" : JUAbajo.Value = "0" : End If
  66. If Window.Event.KeyCode = "73" Or Window.Event.KeyCode = "75" Then : JDArriba.Value = "0" : JDAbajo.Value = "0" : End If
  67. End Sub
  68.  
  69.  
  70. Sub Comenzar
  71. Menu_Principal.Style.Display = "None"
  72. Pantalla_De_Juego.Style.Display = "InLine"
  73. End Sub
  74.  
  75. Sub MoverJugadorUno(Mov)
  76. JugadorUno.Style.Top = CInt(Replace(JugadorUno.Style.Top,"px","")) + CInt(Mov)
  77. End Sub
  78.  
  79. Sub MoverJugadorDos(Mov)
  80. JugadorDos.Style.Top = CInt(Replace(JugadorDos.Style.Top,"px","")) + CInt(Mov)
  81. End Sub
  82.  
  83. Sub Movimiento_Pelota
  84.  
  85. If Replace(Pelota.Style.Top,"px","") > 300 Then
  86. DireccionPelotaX.Value = CInt(-6)
  87. End If
  88. If Replace(Pelota.Style.Top,"px","") < 1 Then
  89. DireccionPelotaX.Value = CInt(+6)
  90. End If
  91. If Replace(Pelota.Style.Left,"px","") > 430 Then
  92. Pelota.Style.Left = "430"
  93. DireccionPelotaY.Value = CInt(-6)
  94. JugadorUnoP.InnerHtml = JugadorUnoP.InnerHtml + CInt(1)
  95. End If
  96. If Replace(Pelota.Style.Left,"px","") < 0 Then
  97. Pelota.Style.Left = "0"
  98. DireccionPelotaY.Value = CInt(+6)
  99. JugadorDosP.InnerHtml = JugadorDosP.InnerHtml + CInt(1)
  100. End If
  101. If Coliciones(Replace(JugadorUno.Style.Left,"px",""), Replace(JugadorUno.Style.Width,"px",""), Replace(JugadorUno.Style.Top,"px",""),Replace(JugadorUno.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  102. Pelota.Style.BackgroundColor = "Yellow"
  103. DireccionPelotaY.Value = CInt(+6)
  104. Else
  105. Pelota.Style.BackgroundColor = "White"
  106. End If
  107. If Coliciones(Replace(JugadorDos.Style.Left,"px",""), Replace(JugadorDos.Style.Width,"px",""), Replace(JugadorDos.Style.Top,"px",""),Replace(JugadorDos.Style.Height,"px",""), Replace(Pelota.Style.Left,"px",""), Replace(Pelota.Style.Width,"px",""), Replace(Pelota.Style.Top,"px",""), Replace(Pelota.Style.Height,"px","")) = "Verdadero" Then
  108. Pelota.Style.BackgroundColor = "Yellow"
  109. DireccionPelotaY.Value = CInt(-6)
  110. Else
  111. Pelota.Style.BackgroundColor = "White"
  112. End If
  113.  
  114. Pelota.Style.Top = Cint(Replace(Pelota.Style.Top,"px","")) + Cint(DireccionPelotaX.Value)
  115. Pelota.Style.Left = Cint(Replace(Pelota.Style.Left,"px","")) + Cint(DireccionPelotaY.Value)
  116.  
  117. If Replace(JugadorUno.Style.Top,"px","") < 2 Then : JugadorUno.Style.Top = 2 : End If
  118. If Replace(JugadorUno.Style.Top,"px","") > 260 Then : JugadorUno.Style.Top = 260 : End If
  119.  
  120. If Replace(JugadorDos.Style.Top,"px","") < 2 Then : JugadorDos.Style.Top = 2 : End If
  121. If Replace(JugadorDos.Style.Top,"px","") > 260 Then : JugadorDos.Style.Top = 260 : End If
  122.  
  123. MoverJugadorUno(JUArriba.value) :  MoverJugadorDos(JDArriba.value)  : MoverJugadorUno(JUAbajo.Value) : MoverJugadorDos(JDAbajo.Value)
  124.  
  125. MP = Window.SetTimeOut("Movimiento_Pelota",1)
  126. End Sub
  127.  
  128. Function Coliciones(x1, width1, y1, height1,x2, width2, y2, height2)
  129. If  (CInt(x1) + CInt(width1)) > (CInt(x2)) and (CInt(x1)) < (CInt(x2) + CInt(width2)) And (CInt(y1) + CInt(height1)) > (CInt(y2)) and (CInt(y1)) < (CInt(y2) + CInt(height2)) Then
  130. Coliciones = "Verdadero"
  131. Else
  132. Coliciones = "Falso"
  133. End If
  134. End Function
  135.  
  136. Sub IniMSJPre
  137. If IniMSJV.Value = "A" then
  138. Ini_MSJ.Style.Display = "None"
  139. IniMSJV.Value = "B"
  140. Else
  141. Ini_MSJ.Style.Display = "Inline"
  142. IniMSJV.Value = "A"
  143. End If
  144. End Sub
  145.  

Fuente: www.code-makers.com/Scripting-by-JohnConnor

Saludos ;)
6  Programación / Scripting / TT Generator 4 Twitter (VBSript + HTA) en: 5 Febrero 2013, 16:42 pm
Hola gente. aca les dejo una pequeña aplicacion hta y vbscript para hacer spam o generar TTs en Twitter.
Creo que no hay mucho que explicar.  deja bien claro el uso de Internet Explorer para hacer aplicaciones y es muy parecido al VB (cada vez me gusta mas el script que el vb).

Una muestra:


                      


Aca para descargar:  http://www.mediafire.com/?xv2b7a5c99fk896


Aca pueden ver el codigo de su foro original: http://johnconnor.net.ms/redirect.php


Saludos
7  Programación / Scripting / Dificultad VBScript [MSXML2.XMLHTTP + RESPONSE.TEXT + TEXT AREA)] en: 16 Enero 2013, 12:37 pm
Buenas. Estoy tratando de hacer un chat mediante el uso de XMLHTTP con vbscript.


el unico problema es que no me lee el txt que escribe y no lo actualiza en el textarea, aunque el txt es escrito y sobreescriot correctamente. alguien puede decirme donde esta el error? y que solucion o alternativa en caso de no poder mediante este metodo.
Es mejor con iExplorer Navigate?

Aca el code:
Código
  1. Sub actel()
  2. nomvar = int(rnd * 888888)
  3. Set nomvar = CreateObject("MSXML2.XMLHTTP")
  4. nomvar.open "GET", "http://localhost/msnvbs/conv83472980093.txt", FALSE
  5. nomvar.send
  6. el.value = nomvar.ResponseText
  7. el.scrollTop=9999999
  8. set nomvar = nothing
  9. MOTORD = WINDOW.SETTIMEOUT("actel()", 5000)
  10. End Sub
  11.  
  12. Sub Document_onKeyPress()
  13. If window.event.keyCode="13" Then
  14. nomvar = int(rnd * 888888)
  15. Set nomvar = CreateObject("MSXML2.XMLHTTP")
  16. nomvar.open "POST", "http://localhost/msnvbs/enviar.php?contrasena=" &contrasena.value& "&nombre=" & nombre.value & "&mensaje=" &yo.value&"", False
  17. nomvar.send
  18. yo.value = ""
  19. el.scrollTop=9999999
  20. set nomvar = nothing
  21. actel()
  22. end if
  23. end sub

Saludos!


PD: Utilizo un nombre random para la variable porque etsaba probando pero no creo que eso cambie nada.
8  Programación / Programación C/C++ / Error codeblocks (build) en: 8 Junio 2012, 17:53 pm
Instale la version completa de codeblock pero cuando quiero compilar me sale el siguiente error:


Execution of 'mingw32-g++.exe  -o bin\Debug\queande.exe obj\Debug\main.o' in 'C:\Users\JohnConnor\Desktop\queande' failed.

Tengo windows 7.

Saludos!
9  Programación / Scripting / Colisiones simples en VBScript + HTA en: 3 Mayo 2012, 10:06 am
Hola, este es mi primer post y les quiero mostrar un "intento de juego" que no tiene como objetivo el entretenimiento sino que es un ejemplo de colisiones básicas en vbscript.

Dejo el link de .rar --->  http://www.mediafire.com/?dcje4xhf7z48445

y aca el codigo:

Código
  1. <HTML><HEAD><SCRIPT LANGUAGE="VBScript">
  2. REM -----------------------------------------------------------------------------
  3. REM              ***************POWERED By JohnConnor************
  4. REM              *        Buenos Aires - Argentina. 30/05/2012  *
  5. REM              *       All code is typed in Notepad++         *
  6. REM              ************************************************
  7. REM .............................................................................
  8. REM                   WEB:  WWW.JUEGOMANIA.WEB44.NET
  9. REM .............................................................................
  10. Sub Window_OnLoad()
  11. self.resizeto 400,400 : obstacle.style.left = 100 : obstacle.style.top = 200
  12. TECLAW.value = "0" : TECLAS.value = "0" : TECLAD.value = "0" : TECLAA.value= "0" : TIEMPO_REFRESH = 100 : MOTOR()
  13. MovimientoE()
  14. End Sub
  15. Sub Document_onKeyPress()
  16. if estado.value = "muerto" then
  17. exit sub
  18. end if
  19. If (UCase(Chr(window.event.keyCode)) = "W") Then
  20. TECLAW.value = "1"
  21. end if
  22. If (UCase(Chr(window.event.keyCode)) = "S") Then
  23. TECLAS.value = "1"
  24. end if
  25. If (UCase(Chr(window.event.keyCode)) = "D") Then
  26. TECLAD.value = "1"
  27. end if
  28. If (UCase(Chr(window.event.keyCode)) = "A") Then
  29. TECLAA.value = "1"
  30. end if
  31. End Sub
  32. Sub Document_onKeyUp()
  33. If (UCase(Chr(window.event.keyCode)) = "W") Then
  34. TECLAW.value = "0"
  35. end if
  36. If (UCase(Chr(window.event.keyCode)) = "S") Then
  37. TECLAS.value = "0"
  38. end if
  39. If (UCase(Chr(window.event.keyCode)) = "D") Then
  40. TECLAD.value = "0"
  41. end if
  42. If (UCase(Chr(window.event.keyCode)) = "A") Then
  43. TECLAA.value = "0"
  44. end if
  45. End Sub
  46. Sub MOTOR()
  47. charX = character.style.left : charX = Left (charX, Len(charX)-2)
  48. charY = character.style.top : charY = Left (charY, Len(charY)-2)
  49. charWidth = character.style.width : charWidth = Left (charWidth, Len(charWidth)-2)
  50. charHeight = character.style.height : charHeight = Left (charHeight, Len(charHeight)-2)
  51. obstX = obstacle.style.left : obstX = Left (obstX, Len(obstX)-2)
  52. obstY = obstacle.style.top : obstY = Left (obstY, Len(obstY)-2)
  53. obstWidth = obstacle.style.width
  54. obstWidth = Left (obstWidth, Len(obstWidth)-2)
  55. obstHeight = obstacle.style.height
  56. obstHeight = Left (obstHeight, Len(obstHeight)-2)
  57. if TECLAA.VALUE = "1" then
  58. if coliciones(charX-2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "" or coliciones(charX-2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "no" then
  59. for i = 0 to 1
  60. charX = charX - 1
  61. next
  62. end if
  63. end if
  64. if TECLAW.value = "1" then
  65. if coliciones(charX, charWidth, charY-2, charHeight, obstX, obstWidth, obstY, obstHeight) = "" or coliciones(charX, charWidth, charY-2, charHeight, obstX, obstWidth, obstY, obstHeight) = "no" then
  66. for i = 0 to 1
  67. charY = charY - 1
  68. next
  69. end if
  70. end if
  71. if  TECLAD.value = "1" then
  72. if coliciones(charX+2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "" or coliciones(charX+2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "no" then
  73. for i = 0 to 1
  74. charX = charX + 1
  75. next
  76. end if
  77. end if
  78. if TECLAS.value = "1" then
  79. if coliciones(charX, charWidth, CInt(charY+2), charHeight, obstX, obstWidth, obstY, obstHeight) = "" or coliciones(charX, charWidth, CInt(charY+2), charHeight, obstX, obstWidth, obstY, obstHeight) = "no" then
  80. for i = 0 to 1
  81. charY = charY + 1
  82. next
  83. end if
  84. end if
  85. character.style.top = CharY
  86. character.style.left = CharX
  87. obstacle.style.top = obstY
  88. obstacle.style.left = obstX
  89. if coliciones(charX, charWidth, CInt(charY+2), charHeight, obstX, obstWidth, obstY, obstHeight) = "si" or coliciones(charX+2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "si" or coliciones(charX, charWidth, charY-2, charHeight, obstX, obstWidth, obstY, obstHeight) = "si" or coliciones(charX-2, charWidth, charY, charHeight, obstX, obstWidth, obstY, obstHeight) = "si" then
  90. if estado.value = "muerto" then
  91. obstacle.src = "Imagenes/vacio.png"
  92. erdisteMan = window.settimeout("Perdiste()", 900)
  93. else
  94. character.src = "Imagenes/boom.gif"
  95. character.style.width = "200"
  96. character.style.height = "200"
  97. estado.value = "muerto"
  98. sonidos.src = "Sonidos/boom.wav"
  99. erdisteMan = window.settimeout("Perdiste()", 900)
  100. end if
  101. end if
  102. MOTORR = WINDOW.SETTIMEOUT("MOTOR()", TIEMPO_REFRESH)
  103. End Sub
  104. Sub Perdiste()
  105. character.src = "Imagenes/vacio.png"
  106. menu.innerhtml = "Game Over"
  107. sonidos.src = ""
  108. sonidos.delay = "0"
  109. End Sub
  110. Sub MovimientoE()
  111. obstX = obstacle.style.left : obstX = Left (obstX, Len(obstX)-2)
  112. obstY = obstacle.style.top : obstY = Left (obstY, Len(obstY)-2)
  113. if obstX = 0 then
  114. obstX = 500
  115. obstY  = int(rnd * 400)
  116. else
  117. obstX = obstX - 2
  118. end if
  119. obstacle.style.top = obstY
  120. obstacle.style.left = obstX
  121. MOTORD = WINDOW.SETTIMEOUT("MovimientoE()", TIEMPO_REFRESH)
  122. End Sub
  123. Function coliciones(x1, width1, y1, height1,x2, width2, y2, height2)
  124. if  (CInt(x1) + CInt(width1)) > (CInt(x2)) and (CInt(x1)) < (CInt(x2) + CInt(width2)) then
  125. if  (CInt(y1) + CInt(height1)) > (CInt(y2)) and (CInt(y1)) < (CInt(y2) + CInt(height2)) then
  126. coliciones = "si"
  127. else
  128. coliciones = "no"
  129. end if
  130. end if
  131. end function
  132. </Script>
  133. <bgsound id="sonidos" src="Sonidos/fondo.wav" loop="infinite" delay="0">
  134. <TITLE>AlienScript</TITLE>
  135. <HTA:APPLICATION
  136. ID="37832459348"
  137. APPLICATIONNAME="VBScript coliciones"
  138. CONTEXTMENU="NO"
  139. ICON="Imagenes/icono.ico"
  140. SCROLL="NO"
  141. SCROLLFLAT="NO"
  142. SELECTION="NO"
  143. SINGLEINSTANCE="YES"
  144. MAXIMIZEBUTTON="NO"
  145. MINIMIZEBUTTON="NO"
  146. VERSION="1.3"
  147. CAPTION="yes"
  148. BORDER="thin"
  149. SysMenu="yes"
  150. INNERBORDER="OFF" />
  151. </head><body topmargin="0" leftmargin="0" rightmargin="0" background="Imagenes/fondo.gif">
  152. <input type="hidden" id="estado" value="vivo">
  153. <input type="hidden" id="TECLAW" value="0"><input type="hidden" id="TECLAS" value="0">
  154. <input type="hidden" id="TECLAD" value="0"><input type="hidden" id="TECLAA" value="0">
  155. <img id="character" style="position:absolute; top:0; left:0; width: 50; height: 50;" src="Imagenes/objUno.png">
  156. <img id="obstacle" style="position:absolute; top: 0; left: 0; width: 30; height: 30;" src="Imagenes/objDos.gif">
  157. <div id="menu" style="position: absolute; top: 160; left: 90; color: lime; font-size: 40; font-family: lucida console; font-effect: emboss;"></div>
  158. </body></html>
  159.  
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines