C
C#12mo ago
Skybro

How do i set a Rectangle to a random X Position?

im trying to make a game where you dodge blocks falling down and when i run the game its only one block on the 0 X coordinate. public static Texture2D Tex; static Random rnd = new Random(); Vector2 Position; Vector2 Velocity; int X = rnd.Next(1, 800); public Rectangle Collision = new Rectangle(200,-100, 32, 32); float Speed = 5; public Blocks() { Collision = new Rectangle(X, -100, 32, 32); Collision.X = (int)Position.X; Collision.Y = (int)Position.Y; }
1 Reply
Exlex
Exlex12mo ago
You don't appear to actually be using the X variable you created to set the position, only for the collision
Want results from more Discord servers?
Add your server