SHARE
TWEET

traffic

a guest Oct 8th, 2014 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. namespace Street_Race_Easy2D
  9. {
  10.     public class TRAFFIC
  11.     {
  12.         public int imagex = 0;
  13.         public int imagey = 0;
  14.         public int speed = 0;
  15.         public int color = 0;
  16.         private Random r = new Random();
  17.  
  18.         public void Render(Graphics g)
  19.         {
  20.             ImageList car_index = new ImageList();
  21.             car_index.ImageSize = new Size(40, 80);
  22.             car_index.Images.Add(
  23.             Image.FromFile(@"Data//GFX//t1.png"));
  24.             car_index.Images.Add(
  25.             Image.FromFile(@"Data//GFX//t2.png"));
  26.             car_index.Images.Add(
  27.             Image.FromFile(@"Data//GFX//t3.png"));
  28.             car_index.Images.Add(
  29.             Image.FromFile(@"Data//GFX//t4.png"));
  30.             car_index.Images.Add(
  31.             Image.FromFile(@"Data//GFX//t5.png"));
  32.             car_index.Images.Add(
  33.             Image.FromFile(@"Data//GFX//t6.png"));
  34.             car_index.Images.Add(
  35.             Image.FromFile(@"Data//GFX//t7.png"));
  36.             car_index.Images.Add(
  37.             Image.FromFile(@"Data//GFX//t8.png"));
  38.  
  39.             Image image = new Bitmap(car_index.Images[color]);
  40.             //------------------------------------------------------------------
  41.             g.DrawImage(image, imagex, imagey);
  42.             //------------------------------------------------------------------
  43.         }
  44.  
  45.         public void Generate_Random_color_0_4()
  46.         {
  47.             color = r.Next(0, 4);
  48.         }
  49.  
  50.         public void Generate_Random_color_4_8()
  51.         {
  52.             color = r.Next(3, 6);
  53.         }
  54.  
  55.     }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top