Hie everyone. Can anyone help me to make a game. That game involves randomly drawing a square on a canvas and randomly Placing a ball anywhere on the canvas. The player wins if the ball ends up inside or on the square twice in a row. I used ball component for actual ball.
App only have canvas , ball component, button titled press me and a label that shows result .
On pressing button square is drawn randomly. I used producer with 3 parameters for drawing square. And ball is randomly placed anyhow on canvas.
Determine if the ball is inside or on the boundary of the square . Ball inside square , lets play label changes to one more time.
User click button again and a new square would be drawn and the ball would be randomly moved. If the ball is inside the square again, the label would now say you win.
N the app must reset when the ball is not inside the square such that only wins if the ball is inside twice in a row.
Also, can u build an app which will count the number of words in a sentence. The app have a text users inout, a submit button and a label to display results. When the submit button is clicked, the app should count each word in the users input. This must use a loop . Once the code had finished counting the words, it should display in the label with each word that appeared in the sentence the count of how many times that word appeared. Like for example: if i enter โ For a for loop count a countโ, the output would be โ for: 2 , a: 2, loop : 1, count: 2โ
Also convert input to uppercase or lowercase when counting/storing the words, so that different capitalization of words wont affect the word count.
Both files gives you an idea how to start, try to modify them according to your needs and if you face errors ask for help. Especially the word_counter gives you all the blocks you need to achieve what you need, all you have to do is put the blocks in an order