Sei sulla pagina 1di 3

2b.

The first screen includes two buttons, one which takes the user to another screen that states
the instructions for my game. When the user selects their chosen level from the list picker, they
are directed to another screen. Initially, the screen orientation was in landscape mode and two
images were placed next to each other. This proved to make things difficult when I was trying to
place image sprites onto the images. I then remembered that image sprites can only be placed on
canvases. I replaced the images with canvases and put the pictures as the background. The other
issue was that the pictures were disoriented on Thunkable. To correctly place the image sprites, I
had to continuously change the sizing of my pictures. Once I resized it back so it would fit the
screen, all the image sprites would be in the incorrect place. I fixed this issue by making the
screen into portrait mode and stacked the canvases, resized aby pixels, on top of each other. This
allowed me to directly place the image sprites onto the correct places on the canvas. After
figuring out the problems, I started to code everything, so it would work properly.
2c.

This algorithm is fundamental to achieve the purpose of my program because it keeps score for
the user and allows the program itself to work as intended. The algorithm within an algorithm
includes an if/then statement within an if/then statement. These two if/then statements ensure that
the user does not get below zero in points and does not get above 50. The mathematical
computations include the labelNumber.Text + 10 and labelNumber.Text – 5; this code either
adds 10 points to the score label or deducts 5 points. The first part of the segment allows the
program to determine if an image sprite was touched, if it was, then points would be added. If an
image sprite was not touched, then points would be deducted. The overall purpose of this chunk
of code is to add or subtract points and allows the user to win the game.
When the canvas is touched, it also calls the procedure ‘win game.’ When the score reaches
above 45 points, then a notifier appears, informing the user that they have won the game.
2d.

My abstraction includes a procedure. I use this procedure throughout my program, allowing my


code to have reduced redundancy and make it easier to manage. This large chunk of code
performs a simple task, but has a lot going on. This particular procedure is included in different
parts of my code, including in the ‘Reset’ button and one of the notifiers. The mathematical
concept includes labelNumber.Text > 0. This makes sure the user does not reset the game if they
have just started. This procedure resets the whole level of the game and asks the user if they are
sure that the want to reset the game.
Program Code:

Potrebbero piacerti anche