Пример #1
0
 public Bibble(BibbleGame game, Texture2D tex, Color color)
     : base(game, tex, new Vector2(111,111))
 {
     this.Color = color;
     BibbleColor = color;
     this.game = game;
 }
Пример #2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (BibbleGame game = new BibbleGame())
     {
         EdgeScene.test();
         game.Run();
     }
 }
Пример #3
0
        void DrawLine(BibbleGame g, Vector2 start, Vector2 end)
        {
            Vector2 edge = end - start;
            // calculate angle to rotate line
            float angle =
                (float)Math.Atan2(edge.Y, edge.X);

            g.SpriteBatch.Draw(g.LinePixel,
                new Rectangle(// rectangle defines shape of line and position of start of line
                    (int)start.X,
                    (int)start.Y,
                    (int)edge.Length(), //sb will strech the texture to fill this rectangle
                    1), //width of line, change this to make thicker line
                null,
                Color.Red, //colour of line
                angle,     //angle of line (calulated above)
                new Vector2(0, 0), // point in line about which to rotate
                SpriteEffects.None,
                0);
        }
Пример #4
0
 internal static List<SimpleCollidableLine> getEdgeData(BibbleGame g)
 {
     List<SimpleCollidableLine> l = new List<SimpleCollidableLine>();
     String json_data;
     if (WEB_REQUEST)
     {
         using (var w = new WebClient())
         {
             // attempt to download JSON data as a string
             try
             {
                 json_data = w.DownloadString(EDLE_URL);
             }
             catch (Exception) { }
             // if string with JSON data is not empty, deserialize it to class and return its instance
             if (string.IsNullOrEmpty(json_data))
             {
                 return null;
             }
         }
     }
     else
     {
         json_data = TEST_JSON;
     }
     EdgeScene e = JsonConvert.DeserializeObject<EdgeScene>(TEST_JSON);
     Console.WriteLine("parsed JSON:");
     Console.WriteLine(e.Objects.Count + " Polygons parsed");
     foreach (EdgeObject o in e.Objects.Values) {
         if (o.Points.Count() <= 1)
         {
             Console.WriteLine("Polygon has not enough points to make lines");
             continue;
         }
         for (int i = 0; i < o.Points.Count(); i++)
         {
             l.Add(new SimpleCollidableLine(g, o.getPoint(i, g), o.getPoint((i + 1) % (o.Points.Count() - 1), g)));
         }
     }
     return l;
 }
 public SmokePlumeParticleSystem(BibbleGame game, int howManyEffects)
     : base(game,howManyEffects)
 {
 }
Пример #6
0
 /// <summary>
 /// Constructs a new ParticleSystem.
 /// </summary>
 /// <param name="game">The host for this particle system. The game keeps the 
 /// content manager and sprite batch for us.</param>
 /// <param name="howManyEffects">the maximum number of particle effects that
 /// are expected on screen at once.</param>
 /// <remarks>it is tempting to set the value of howManyEffects very high.
 /// However, this value should be set to the minimum possible, because
 /// it has a large impact on the amount of memory required, and slows down the
 /// Update and Draw functions.</remarks>
 protected ParticleSystem(BibbleGame game, int howManyEffects)
     : base(game)
 {
     this.game = game;
     this.howManyEffects = howManyEffects;
 }
 public ExplosionParticleSystem(BibbleGame game, int howManyEffects)
     : base(game, howManyEffects)
 {
 }
Пример #8
0
 public Bibble(BibbleGame game, Texture2D tex)
     : this(game, tex, Color.White)
 {
 }
Пример #9
0
 public ItemSpawner(BibbleGame game, int spawnTime)
     : base(game)
 {
     SpawnTime = spawnTime;
     mCountDownMS = spawnTime;
 }
Пример #10
0
 public ItemSpawner(BibbleGame game)
     : this(game, DEFAULT_SPAWN_MS)
 {
 }