I created a seperate class for making a sprite randomly change directions and the constructor looks like this:
public RandomDirectionSprite(Texture2D textureImage, Vector2 position,
Point frameSize, int collisionOffset, Point currentFrame,
Point sheetSize, Vector2 speed, string collisionCueName,
SpriteManager spriteManager, Random randomDirection)
: base(textureImage, position, frameSize, collisionOffset,
currentFrame, sheetSize, speed, collisionCueName)
{
this.spriteManager = spriteManager;
this.randomDirection = randomDirection;
DirectionTimer();
}
Now, I also created a Sprite Manager which adds a sprite to a list like this:
spriteList.Add(new EvadingSprite(Game.Content.Load<Texture2D>
(@"images\plus"), position, new Point(75, 75), 10,
new Point(0, 0), new Point(6, 4), speed, "skullcollision"
, this,*//<Random should go here>//*));
I'm not sure how to put the Random parameter in. That is how do I add it in.
Here is the Timer that appears in my RandomDirectioinSprite class along with the other variables that are used to make it:
private void DirectionTimer()
{
nextDirectionTimer = randomDirection.Next(
directionTimerMin,
directionTimerMax);
}
Anyway, I hope my question makes sense, and I thank anyone who can help!