Hi all I m making a simple game in C# (Catch ME). In this game there will be a button to catch. when a user moves the pointer to click on to it. It moves further and doesnt get clicked. i have done it by changing the location of the button. But by doing so, the button moves in a fixed set location and also when pointer is brought near the form boundries the button gets out of the form or becomes invisible. So i want the some random number be generated and assigned to the location property of the button so that button moves randomly. Also ensure that it must be within the form boundries.
Thanks in advance for any Idea
Gaurav arora
0
Junior Poster in Training
Recommended Answers
Jump to PostRandom class helps you, but your problem is easier than generating random number and so on. what you need is to detect Mouse.X and Mouse.Y and change the location of button to be out this area.
Jump to PostGenerating number between 1 and 100
Random random = new Random(); return random.Next(1, 100);
Jump to PostIf this the solution please mark this thread as solved. :)
All 9 Replies
Ramy Mahrous
401
Postaholic
Featured Poster
Gaurav arora
0
Junior Poster in Training
Gaurav arora
0
Junior Poster in Training
Ramy Mahrous
401
Postaholic
Featured Poster
Gaurav arora
0
Junior Poster in Training
Ramy Mahrous
401
Postaholic
Featured Poster
Gaurav arora
0
Junior Poster in Training
Gaurav arora
0
Junior Poster in Training
Ramy Mahrous
401
Postaholic
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.