Beispiel #1
0
 public void Update(Dude d)
 {
     if (isActive)
     {
         if (W.area.X < 0 - W.area.Width)
         {
             W.area.X += 15;
         }
         else
         {
             deltaY = d.web.area.Y - W.area.Y;
             deltaX = d.web.area.X - W.area.X;
             angle = Math.Atan2(deltaY, deltaX);
             ++randomDelay;
             if (randomDelay > 100)
             {
                 randomAngle = (extendedRanAngle.Next((int)((Math.PI / 2) * 1000)) / 1000.0 - (Math.PI / 4));
                 randomDelay = 0;
             }
             angle += randomAngle;
             W.area.X += (int)(onScreenSpeed * (float)Math.Cos(angle));
             W.area.Y += (int)(onScreenSpeed * (float)Math.Sin(angle));
         }
     }
 }
Beispiel #2
0
 //used to load a level
 public void LoadLevel(string tileAsset, string levelPath, string charAssetSheet)
 {
     samplelevel = new Level(Content.Load<Texture2D>(tileAsset), CSVRead.getLevel(levelPath));
     dude = new Dude(new Rectangle(200, 500, dudeWidth, dudeHeight), Content.Load<Texture2D>(charAssetSheet));
 }