Advertisement
Guest User

FoodObject

a guest
Mar 5th, 2012
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Drawing;
  6.  
  7. namespace SnakeV2
  8. {
  9.     class FoodObject
  10.     {
  11.         public Point Point;
  12.         Random rnd = new Random();
  13.  
  14.         public FoodObject()
  15.         {
  16.             Point = new Point(rnd.Next(2, Console.WindowHeight - 2), rnd.Next(2, Console.WindowWidth - 2));
  17.         }
  18.  
  19.         public void Draw()
  20.         {
  21.             Console.SetCursorPosition(Point.Y, Point.X);
  22.             Console.Write('*');
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement