Using Using Using Using Using Using Namespace Class New Int New Int Public Void
Using Using Using Using Using Using Namespace Class New Int New Int Public Void
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace PrjCiudad
{
class ClassCiudad
{
Random r = new Random();
int random = 0;
Point pos = new Point();
int caso = 0;
public void Random()
{
random = r.Next(1 , 2);
}
public void Marcha(PictureBox carro,Timer tiempo)
{// marcha de lado
// hacia arriba
else if (carro.Location.X >= 94 && carro.Location.Y == 366 ||
carro.Location.X >= 89 && carro.Location.Y == 183
|| carro.Location.X >= 99 && carro.Location.Y == 29)
{
pos.X = carro.Location.X + 2;
pos.Y = carro.Location.Y;
carro.Location = pos;
}
//Calle Curva2
if (carro.Location.X == 286 && carro.Location.Y == 414)
{
pos.X = carro.Location.X + 10;
pos.Y = carro.Location.Y+3;
carro.Location = pos;
carro.Location = new Point(296, 417);
carro.Size = new Size(40, 50);
carro.Image = Image.FromFile(@"F:\imgenes Vehiculos\oie_transparent
(9).PNG");
tiempo.Interval = 500;
}
else if (carro.Location.X == 296 && carro.Location.Y == 417)
{
carro.Location = new Point(300, 427);
tiempo.Interval = 500;
}
else if (carro.Location.X == 300 && carro.Location.Y == 427)
{
carro.Location = new Point(303, 443);
tiempo.Interval = 500;
}
else if (carro.Location.X == 303 && carro.Location.Y == 443)
{
carro.Location = new Point(309, 450);
tiempo.Interval = 500;
}
else if (carro.Location.X == 309 && carro.Location.Y == 450)
{
carro.Location = new Point(325, 476);
tiempo.Interval = 500;
}
else if (carro.Location.X == 325 && carro.Location.Y == 476)
{
carro.Location = new Point(331, 489);
tiempo.Interval = 500;
}
else if (carro.Location.X == 331 && carro.Location.Y == 489)
{
carro.Location = new Point(344, 510);
tiempo.Interval = 500;
}
else if (carro.Location.X == 344 && carro.Location.Y == 510)
{
carro.Location = new Point(356, 523);
tiempo.Interval = 500;
}
else if (carro.Location.X == 356 && carro.Location.Y == 523)
{
carro.Location = new Point(370, 547);
tiempo.Interval = 500;
}
else if (carro.Location.X == 370 && carro.Location.Y == 547)
{
carro.Location = new Point(383, 566);
tiempo.Interval = 500;
}
else if (carro.Location.X == 383 && carro.Location.Y == 566)
{
carro.Location = new Point(388, 380);
tiempo.Interval = 500;
}
else if (carro.Location.X == 388 && carro.Location.Y == 380)
{
carro.Location = new Point(391, 593); tiempo.Interval = 500;
}
else if (carro.Location.X == 391 && carro.Location.Y == 593)
{
carro.Location = new Point(404, 614); tiempo.Interval = 500;
}
else if (carro.Location.X == 404 && carro.Location.Y ==614)
{
carro.Location = new Point(410, 622); tiempo.Interval = 500;
}
//Esquinas
if (carro.Location.X >= 52 && carro.Location.Y == 412)
{
Random();
if (random == 1)
{
}
//
if (carro.Location.X == 52 && carro.Location.Y == 219)
{
Random();
if (random == 1)
{
carro.Location = new Point(89, 183);
carro.Size = new Size(55, 26);
carro.Image = Image.FromFile(@"F:\imgenes
Vehiculos\horizontal.JPG");
}
}
//
if (carro.Location.X == 52 && carro.Location.Y == 70)
{
carro.Location = new Point(99, 29);
carro.Size = new Size(55, 25);
carro.Image = Image.FromFile(@"F:\imgenes
Vehiculos\horizontal.JPG");
}
//
if (carro.Location.X == 206 && carro.Location.Y == 366)
{
Random();
if (random == 1)
{
carro.Location = new Point(286, 414);
carro.Size = new Size(30, 50);
carro.Image = Image.FromFile(@"F:\imgenes
Vehiculos\oie_transparent - copia.PNG");
}
}
}
apagado2.Visible = false;
amarillo.Visible = true;
tiempo.Interval = 2000;
caso = 2;
break;
case 2 :
apagado1.Visible = false;
apagado2.Visible = true;
amarillo.Visible = false;
rojo.Visible = true;
tiempo.Interval = 5000;
caso = 0;
break;
}
}
}
}