Título: juego del ping pong Publicado por: chaarlyyyy en 9 Octubre 2009, 05:41 am hola necesito ayuda con este ejercicio tngo que hacer que rebote por las 4 paredes pero solo logro hacer que rebote derecho
esto es lo que he echo Private Sub Form_KeyPress(KeyAscii As Integer) 'Print "tecla:"; Chr$(KeyAscii) 'Print "valor"; KeyAscii If KeyAscii = 119 And Shape1.Top > 100 Then Shape1.Top = Shape1.Top - 100 End If If KeyAscii = 120 And Shape1.Top < 8900 Then Shape1.Top = Shape1.Top + 100 End If If KeyAscii = 56 And Shape2.Top > 100 Then Shape2.Top = Shape2.Top - 100 End If If KeyAscii = 50 And Shape2.Top < 8800 Then Shape2.Top = Shape2.Top + 100 End If If KeyAscii = 115 Then Shape1.Height = Shape1.Height - 50 Shape1.Top = Shape1.Top - 25 End If If KeyAscii = 97 Then Shape1.Height = Shape1.Height + 50 Shape1.Top = Shape1.Top + 25 End If If KeyAscii = 53 Then Shape2.Height = Shape2.Height - 50 Shape2.Top = Shape2.Top - 25 End If If KeyAscii = 48 Then Shape2.Height = Shape2.Height + 50 Shape2.Top = Shape2.Top + 25 End If End Sub Private Sub Timer1_Timer() Randomize x = Int(Rnd(30) * 20) If i = 0 Then Shape3.Left = Shape3.Left + (x * 10) Else Shape3.Left = Shape3.Left - (x * 10) End If If Shape3.Left < 100 Then i = 1 End If If Shape3.Left > 18378 Then i = 1 End If If Shape3.Left - 495 <= Shape1.Left And Shape3.Top > Shape1.Top And Shape3.Top < Shape1.Top + 1815 Then i = 0 End If End Sub Título: Re: juego del ping pong Publicado por: BlackZeroX en 9 Octubre 2009, 08:10 am http://foro.elhacker.net/programacion_vb/tengo_un_problema-t269981.0.html
Tengo entendido que para eso podrias mejor usar Seno, Coseno, Tangente y Teorema de PITAGORAS para a calcular los puntos en X,Y y saber si llegas a un punto de rebote. Y si acaso lo requieres V=D/T para calcular los catetos correspondientes según la velocidad de la pelota. Mira un video de lo que te he mencionado: yizdJXO2yME P.D.: Busca en PSC hay hay ejemplos. Dulces Lunas!¡. Título: Re: juego del ping pong Publicado por: LeandroA en 9 Octubre 2009, 21:31 pm Aca hay un poco mas de infor para aprender sobre senos.
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/lPHw3jhsJ74&hl=es&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lPHw3jhsJ74&hl=es&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object> ;D ;D Título: Re: juego del ping pong Publicado por: xkiz ™ en 9 Octubre 2009, 23:13 pm jajajajaja......
Título: Re: juego del ping pong Publicado por: Hasseds en 9 Octubre 2009, 23:52 pm :o
Título: Re: juego del ping pong Publicado por: BlackZeroX en 10 Octubre 2009, 05:27 am :o :xD :¬¬ :-X |