At the moment, the red color circle can be played only once, can the game continue to play maybe for 1 minute, then it will stop and show the scores? And when the following game continues, so the answer to the game will be automatically changed.
I think the goal you wanted to create with this was to drag the red ball to the red square/corner right? Iâve tried to make minimal changes in order to get to a âgame loopâ where we check for the condition isGameOver() in every loop, and a setupGame() function to call in order to restart
Awesome, thank you so much for your help, that is what I want! Do you know how could make the questions placed in different locations, and the answers are different, rather than the red color circle always showing on the interface.
Currently, you have hard coded the location of the red square in your collision checker. What you probably want now is to make a general square <-> ball collision detection function, that takes in the square & the ball, and outputs whether the ball is colliding with the square or not!
something like the following (note: this is untested code & the parameters square and ball are hypothetical objects), Iâm not sure if youâve looked into classes yet, but if you have, then square and ball can be thought of as classes with properties such as âwidth, height, x and yâ:
Thanks a lot for spending your time on it. Yes, I like to make the âquestionsâ and âanswersâ appear randomly when the game is continuing. And I like to put the image(png) as the sources of questions and answers, rather than draw the circle and square with colors.