I have an assignment on making a basic clicking game. Bassically I need to make the user click the two buttons as fast as posible to increase the score before the time runs out. Can someone please help me with the code?? I already have designed the layout in the picture below. I know that I have to double click the button in the design view and write the code in but I am lost on what to write in it. I am a extreme new at this so please be very specific when decribing things to me. Thanks!!
If you are too lazy to read my post I will sumarize it below!!
I need a program that:
- triggers the timer when I click the "start game" button
- resets the game when I click the "start game" button
- stop the game when time reaches 0
- Increase the score by 1 when I click the "Click here" button
- only 1 "click here" button should be allowed at 1 time
What code do i write in each button to make this work???
I don't think anybody will volunteer the code for your assignment. Instead you should work this out and post specific questions should you get stuck at some point. Basically demonstrate that you have actually tried. Otherwise this type of post is just annoying: "Why should I do your homework?", most people ask themselves.
I won't give you a full-code solution but I will pitch you ideas.
The first and only idea that sprung to mind involves creating threads. The basic idea is that the timer runs on a separate thread while the user's input uses the main program thread. That way, the timer and user input are running simultaneously. However, I don't know how much of C/C++ you know.
If you run the timer and user input at the same time, using the main thread, your timer will only decrease after the user clicks. By the sounds of it, this is not what you wan't.
Sorry if Im a little vague. So far Im stuck at this problem: What do I need to write in this to start the timer?? The label that tells the time is called label1. This is the start game button by the way.