Skybro
Skybro
CC#
Created by Skybro on 12/10/2023 in #help
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; }
2 replies