Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public
Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PracticaAplicadaI
{
public partial class PinPon : Form
{
public PinPon()
{
InitializeComponent();
}
timer1.Enabled = true;
timer2.Enabled = true;
if (movDer == true)
{
if (pictureBox1.Left <= this.ClientRectangle.Width -
pictureBox1.Width)
pictureBox1.Left += 2;
else
movDer = false;
}
else
{
if (pictureBox1.Left >= 0)
pictureBox1.Left -= 2;
else
movDer = true;
}
if (movArrib == true)
{
if (pictureBox1.Top >= 0)
pictureBox1.Top -= 2;
else
movArrib = false;
}
else
pictureBox1.Top += 2;
//rebote de la pelota
if (movArrib == true)
{
if (pictureBox1.Top >= 0)
pictureBox1.Top -= 2;
else
movArrib = false;
}
if (pictureBox1.Top + pictureBox1.Height >= panel1.Top &&
pictureBox1.Top + pictureBox1.Height <= panel1.Top + panel1.Height
&&
pictureBox1.Left + pictureBox1.Width >= panel1.Left &&
pictureBox1.Left + pictureBox1.Width <= panel1.Left + panel1.Width)
{
movArrib = true;
}
}
if (i >= 30)
{
timer1.Enabled = false;
timer2.Stop();
MessageBox.Show("Ganaste!!!");
}
}