Exemplo n.º 1
0
 public BouncingLogo(Content content, Randomizer random)
     : base(content.Load<Image>("DeltaEngineLogo"), Rectangle.One, Color.GetRandomColor())
 {
     DrawArea = Rectangle.FromCenter(Point.Half, new Size(random.Get(0.1f, 0.2f)));
     velocity = new Point(random.Get(-0.4f, +0.4f), random.Get(-0.4f, +0.4f));
     Rotation = random.Get(0, 360);
     rotationSpeed = random.Get(-50, 50);
 }
Exemplo n.º 2
0
		private static Rectangle CreateDrawArea(Randomizer randomizer, int sizeModifier)
		{
			var randomPosition =
				new Vector2D(
					randomizer.Get(-100, 100) > 0 ? ScreenSpace.Current.Left - .1f : ScreenSpace.Current.Right,
					randomizer.Get(-100, 100) > 0 ? ScreenSpace.Current.Top - .1f : ScreenSpace.Current.Bottom);
			var modifiedSize = new Size(.1f / sizeModifier);
			return new Rectangle(randomPosition, modifiedSize);
		}
Exemplo n.º 3
0
		private Vector2D GetInitialVelocity(Randomizer randomizer)
		{
			var randomizedAxisValue = randomizer.Get(.03f, .15f);
			var randomXAimingForCenter = (Center.X > 0.5f) ? -randomizedAxisValue : randomizedAxisValue;
			var randomYAimingForCenter = (Center.Y > 0.5f) ? -randomizedAxisValue : randomizedAxisValue;
			return new Vector2D(randomXAimingForCenter, randomYAimingForCenter);
		}
 private void Reset(Randomizer random)
 {
     DrawArea = Rectangle.FromCenter(Point.Half, new Size(random.Get(0.1f, 0.2f)));
     velocity = new Point(random.Get(-0.4f, +0.4f), random.Get(-0.4f, +0.4f));
 }