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

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  PONG Game - Simple Juego "Pong" [VBScript + HTA] (100% Notepad)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: PONG Game - Simple Juego "Pong" [VBScript + HTA] (100% Notepad)  (Leído 4,994 veces)
JohnConnor

Desconectado Desconectado

Mensajes: 16


Cyberdine Systems


Ver Perfil WWW
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 ;)


« Última modificación: 26 Febrero 2013, 09:31 am por JohnConnor » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Pong en c#
.NET (C#, VB.NET, ASP)
isseu 0 3,753 Último mensaje 3 Marzo 2009, 15:29 pm
por isseu
juego del ping pong
Programación Visual Basic
chaarlyyyy 5 5,755 Último mensaje 10 Octubre 2009, 05:27 am
por BlackZeroX
[JUEGO] Pong! XD « 1 2 »
Programación Visual Basic
79137913 18 7,875 Último mensaje 11 Febrero 2011, 12:23 pm
por 79137913
Pong no se ejecuta en JCreator, manda un error de agregara la carpeta "images"
Java
LuzNeon 0 2,333 Último mensaje 25 Noviembre 2011, 06:53 am
por LuzNeon
VBScript: Angry Birds Pong in VBScript [HTA + VBS] (100% Notepad) by JohnConnor
Scripting
JohnConnor 1 4,850 Último mensaje 4 Marzo 2013, 23:34 pm
por dato000
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines