Sub Window_OnLoad
Cargando.Style.Display = "None"
If Screen.Width < 800 or Screen.Height < 600 Then
Msgbox "Error: 0x1028 " & Chr(13) & "Su resolucion de patalla no permite la ejecucion de la aplicacion."
End If
Self.ResizeTo 800,600
Pantalla_De_Juego.Style.Display = "None"
Pantalla_Ganador.Style.Display = "None"
Menu_Principal.Style.Color = "Gray"
Menu_Principal.Style.FontSize = "12"
Menu_Principal.Style.Position = "Absolute"
Menu_Principal.Style.Top = "70"
Menu_Principal.Style.Left = "45"
JugadorUnoP.Style.Position = "Absolute"
JugadorDosP.Style.Position = "Absolute"
JugadorUnoP.Style.fontSize = "50"
JugadorDosP.Style.fontSize = "50"
JugadorUnoP.Style.Top = "10"
JugadorDosP.Style.Top = "10"
JugadorUnoP.Style.Left = 300
JugadorDosP.Style.Left = 500
' --- Configuracion JugadorDos --- *
JugadorUno.Style.Position = "Absolute"
JugadorUno.Style.Width = "60"
JugadorUno.Style.Height = "60"
JugadorUno.Style.Top = "40"
JugadorUno.Style.Left = "10"
' --- Configuracion de JugadorDos --- *
JugadorDos.Style.Position = "Absolute"
JugadorDos.Style.Width = "60"
JugadorDos.Style.Height = "60"
JugadorDos.Style.Top = "90"
JugadorDos.Style.Left = "740"
' --- Configuracion de Pelota --- *
Pelota.Style.Position = "Absolute"
Pelota.Style.Width = "30"
Pelota.Style.Height = "30"
Pelota.Style.Top = "100"
Pelota.Style.Left = "100"
LD.Style.Position = "Absolute"
LD.Style.Width = "3"
LD.Style.Height = "600"
LD.Style.Left = "400"
LD.Style.Display = "None"
VolumenIMG.Style.Position = "Absolute"
VolumenIMG.Style.Bottom = "15"
VolumenIMG.Style.Right = "5"
VolumenIMG.Style.ZIndex = "999"
FacebookIMG.Style.Position = "Absolute"
FacebookIMG.Style.Bottom = "16"
FacebookIMG.Style.Left = "5"
FacebookIMG.Style.ZIndex = "999"
TwitterIMG.Style.Position = "Absolute"
TwitterIMG.Style.Bottom = "15"
TwitterIMG.Style.Left = "50"
TwitterIMG.Style.ZIndex = "999"
Publicidad.Style.Position = "Absolute"
Publicidad.Style.Bottom = "5"
Publicidad.Style.Left = "160"
Publicidad.Style.Width = "468"
Publicidad.Style.Height = "60"
Publicidad.Style.ZIndex = "9999"
Publicidad.Style.OverFlow = "Hidden"
PublicidadDos.Style.Position = "Absolute"
PublicidadDos.Style.Top = "170"
PublicidadDos.Style.Left = "110"
PublicidadDos.Style.Width = "300"
PublicidadDos.Style.Height = "250"
PublicidadDos.Style.ZIndex = "9999"
PublicidadDos.Style.OverFlow = "Hidden"
FondoGanador.Style.Position = "Absolute"
FondoGanador.Style.Top = "100"
FondoGanador.Style.Left = "70"
IMGanador.Style.Position = "Absolute"
IMGanador.Style.Top = "220"
IMGanador.Style.Left = "500"
Imganador.Style.Width = "150"
Imganador.Style.Height = "150"
Piso.Style.Position = "Absolute"
Piso.Style.Width = "800"
Piso.Style.Height = "87"
Piso.Style.Bottom = "0"
Piso.Style.BackgroundImage = "Url(Imagenes/Piso.png)"
JugadorUnoPTXT.Value = "0" : JugadorDosPTXT.Value = "0"
JugadorUnoP.InnerHtml = "<img src=""Imagenes/p" & JugadorUnoPTXT.Value & ".png"">" : JugadorDosP.InnerHtml = "<img src=""Imagenes/p" & JugadorDosPTXT.Value & ".png"">"
End Sub
Sub Document_OnKeyPress
If Window.Event.KeyCode = "27" Then : Salir : End If
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
If Window.Event.KeyCode = "119" Then : JUArriba.Value = "-4" : End If
If Window.Event.KeyCode = "115" Then : JUAbajo.Value = "4" : End If
If Window.Event.KeyCode = "105" Then : JDArriba.Value = "-4" : End If
If Window.Event.KeyCode = "107" Then : JDAbajo.Value = "4" : End If
End Sub
Sub Document_OnKeyUp
If Window.Event.KeyCode = "87" Or Window.Event.KeyCode = "83" Then : JUArriba.Value = "0" : JUAbajo.Value = "0" : End If
If Window.Event.KeyCode = "73" Or Window.Event.KeyCode = "75" Then : JDArriba.Value = "0" : JDAbajo.Value = "0" : End If
End Sub
Sub BotonArrancar_OnMouseOver
MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/BotonArriba.wav""",1)
BotonArrancar.SRC= "Imagenes/startbd.png"
End Sub
Sub BotonArrancar_OnMouseOut
If E.Value = "0" Then
MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Menu_Principal.mp3""",1)
BotonArrancar.SRC= "Imagenes/startb.png"
End If
End Sub
Sub BotonArrancar_OnClick
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/BotonOk.wav""",1)
Comenzar : Movimiento_Pelota : E.Value = "1"
End Sub
Sub Comenzar
Menu_Principal.Style.Display = "None"
Pantalla_De_Juego.Style.Display = "InLine"
MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/AmbienteJuego.mp3""",400)
SonidosAmbiente.Volume = "0"
End Sub
Sub MoverJugadorUno(Mov)
JugadorUno.Style.Top = CInt(Replace(JugadorUno.Style.Top,"px","")) + CInt(Mov)
End Sub
Sub MoverJugadorDos(Mov)
JugadorDos.Style.Top = CInt(Replace(JugadorDos.Style.Top,"px","")) + CInt(Mov)
End Sub
Sub Movimiento_Pelota
If JugadorUnoPTXT.Value > 9 Then
MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Juego_Ganado.mp3""",1)
Pantalla_Ganador.Style.Display = "Inline"
IMGanador.SRC = "Imagenes/JU.png"
Exit Sub
End If
If JugadorDosPTXT.Value > 9 Then
MusicaMaestro = Window.SetTimeOut("SonidosAmbiente.Src = ""Sonidos/Juego_Ganado.mp3""",1)
Pantalla_Ganador.Style.Display = "Inline"
IMGanador.SRC = "Imagenes/JD.png"
Exit Sub
End If
If Replace(Pelota.Style.Top,"px","") > 463 Then
DireccionPelotaX.Value = CInt(-4)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Rebotando.wav""",1)
End If
If Replace(Pelota.Style.Top,"px","") < 1 Then
DireccionPelotaX.Value = CInt(+4)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Rebotando.wav""",1)
End If
If Replace(Pelota.Style.Left,"px","") > 780 Then
Pelota.Style.Left = "760"
DireccionPelotaY.Value = CInt(-4)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Festejo.wav""",1)
IMGP.SRC = "Imagenes/1.png"
JugadorUnoPTXT.Value = JugadorUnoPTXT.Value + Cint(1)
JugadorUnoP.InnerHtml = "<img src=""Imagenes/p" & JugadorUnoPTXT.Value & ".png"">"
End If
If Replace(Pelota.Style.Left,"px","") < 0 Then
Pelota.Style.Left = "0"
DireccionPelotaY.Value = CInt(+4)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Festejo.wav""",1)
IMGP.SRC = "Imagenes/0.png"
JugadorDosPTXT.Value = JugadorDosPTXT.Value + Cint(1)
JugadorDosP.InnerHtml = "<img src=""Imagenes/p" & JugadorDosPTXT.Value & ".png"">"
End If
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
'Pelota.Style.BackgroundColor = "Yellow"
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Tiro.wav""",1)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Pajaro_Volando.wav""",300)
DireccionPelotaY.Value = CInt(+ Int((8 - 5 + 1) * RND + 5))
If DireccionPelotaX.Value > 0 Then
DireccionPelotaX.Value = CInt(+ Int((10 - 1 + 1) * RND + 1))
Else
DireccionPelotaX.Value = CInt(- Int((10 - 1 + 1) * RND + 1))
End If
IMGP.SRC = "Imagenes/0.png"
Else
'Pelota.Style.BackgroundColor = "White"
End If
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
'Pelota.Style.BackgroundColor = "Yellow"
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/Tiro.wav""",1)
MusicaMaestro = Window.SetTimeOut("SonidosJuego.Src = ""Sonidos/PajaroVolando.wav""",300)
DireccionPelotaY.Value = CInt(- Int((8 - 5 + 1) * RND + 5))
If DireccionPelotaX.Value < 0 Then
DireccionPelotaX.Value = CInt(- Int((10 - 1 + 1) * RND + 1))
Else
DireccionPelotaX.Value = CInt(+ Int((10 - 1 + 1) * RND + 1))
End If
IMGP.SRC = "Imagenes/1.png"
Else
'Pelota.Style.BackgroundColor = "White"
End If
Pelota.Style.Top = Cint(Replace(Pelota.Style.Top,"px","")) + Cint(DireccionPelotaX.Value)
Pelota.Style.Left = Cint(Replace(Pelota.Style.Left,"px","")) + Cint(DireccionPelotaY.Value)
If Replace(JugadorUno.Style.Top,"px","") < 2 Then : JugadorUno.Style.Top = 2 : End If
If Replace(JugadorUno.Style.Top,"px","") > 433 Then : JugadorUno.Style.Top = 433 : End If
If Replace(JugadorDos.Style.Top,"px","") < 2 Then : JugadorDos.Style.Top = 2 : End If
If Replace(JugadorDos.Style.Top,"px","") > 433 Then : JugadorDos.Style.Top = 433 : End If
MoverJugadorUno(JUArriba.value) : MoverJugadorDos(JDArriba.value) : MoverJugadorUno(JUAbajo.Value) : MoverJugadorDos(JDAbajo.Value)
MP = Window.SetTimeOut("Movimiento_Pelota",1)
End Sub
Function Coliciones(x1, width1, y1, height1,x2, width2, y2, height2)
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
Coliciones = "Verdadero"
Else
Coliciones = "Falso"
End If
End Function
Sub IniMSJPre
If IniMSJV.Value = "A" then
Ini_MSJ.Style.Display = "None"
IniMSJV.Value = "B"
Else
Ini_MSJ.Style.Display = "Inline"
IniMSJV.Value = "A"
End If
End Sub
Sub Salir
Set WshShell = CreateObject("WScript.Shell")
Return = WshShell.Run("http://angrybirds.hol.es/pong/Comparte.php", 1,False)
Self.Close
End Sub
Sub TwitterIMG_OnMouseOver
TwitterIMG.SRC = "Imagenes/Twitter0.png"
End Sub
Sub FacebookIMG_OnMouseOver
FacebookIMG.SRC = "Imagenes/Facebook0.png"
End Sub
Sub TwitterIMG_OnMouseOut
TwitterIMG.SRC = "Imagenes/Twitter1.png"
End Sub
Sub FacebookIMG_OnMouseOut
FacebookIMG.SRC = "Imagenes/Facebook1.png"
End Sub
Sub TwitterIMG_OnClick
Set WshShell = CreateObject("WScript.Shell")
Return = WshShell.Run("http://www.twitter.com/AngryBirdsPong", 1,False)
End Sub
Sub FacebookIMG_OnClick
Set WshShell = CreateObject("WScript.Shell")
Return = WshShell.Run("http://fb.me/AngryBirdsPong", 1,False)
End Sub
Sub VolumenIMG_OnMouseOver
VolumenIMG.SRC = "Imagenes/Volumen1.png"
End Sub
Sub VolumenIMG_OnMouseOut
VolumenIMG.SRC = "Imagenes/Volumen0.png"
End Sub
Sub VolumenIMG_OnClick
If Vol.Value = "si" then
SonidosAmbiente.Volume = "-10000"
SonidosJuego.Volume = "-10000"
Vol.Value = "no"
Else
SonidosAmbiente.Volume = "0"
SonidosJuego.Volume = "0"
Vol.Value = "si"
End If
End Sub
Sub Volver
Set WshShell = CreateObject("WScript.Shell")
If JugadorUnoPTXT.Value > 9 or JugadorDosPTXT.value > 9 Then
Return = WshShell.Run("VolverAJugar.vbs", 1, False)
Self.Close
End If
End Sub