0% found this document useful (0 votes)
61 views2 pages

Create Task 2

The program is a clicker game created in Code.org's App Lab, which uses JavaScript. The purpose is to upgrade a fort by clicking and accumulating points. Figuring out how to track total clicks was difficult initially, but setting a variable to increment with each click solved that problem. Another issue was making the points affect the game; if/else statements with inequalities allowed the images and buttons to change when point thresholds were reached. The key part of the code uses an if statement to hide one element and show another when the point variable reaches 33, abstracting the level progression into a repeatable function.

Uploaded by

api-462934989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views2 pages

Create Task 2

The program is a clicker game created in Code.org's App Lab, which uses JavaScript. The purpose is to upgrade a fort by clicking and accumulating points. Figuring out how to track total clicks was difficult initially, but setting a variable to increment with each click solved that problem. Another issue was making the points affect the game; if/else statements with inequalities allowed the images and buttons to change when point thresholds were reached. The key part of the code uses an if statement to hide one element and show another when the point variable reaches 33, abstracting the level progression into a repeatable function.

Uploaded by

api-462934989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Create – Applications From Ideas

Written Response Submission Template


Program Purpose and Development
2a)
The programing language used for this project was Code.org’s App Lab, which is similar to
javascript. I used this language because it is the language that I have gotten the most familiar
with over the year, and it is the only language that I have learned thus far in my computer
science venture. The purpose of the code was to create a clicker game in which you upgrade
your fort by clicking your fort and working on it. The more you click, the higher you can
upgrade your fort and the better it looks. The video illustrates some game play from the game
and shows how you upgrade your fort in an effort to make it better. It also shows part of the
code and how it runs to be able to show you the inner workings of the game.

2b)
I encountered several difficulties in the process of writing this code. One of these problems
was that within the program that I was using, I wasn’t able to figure out how to add up the
points of the clicks. Through trial and error, and going over some of the previous lessons we
had learned in our class, I found that I had to set the variable x equal to 0, and then within the
onEvent function I had to make it x=x+1 to be able to actually add another point for every
click. After figuring this out, I was still unsure of how to make the points in the game affect the
game play. I knew how to be able to add up the points but, I wasn’t able to get them to
change the screen or image. To fix this problem, I asked my partner in my computer science
class if he had any suggestions as to what I could do, and he was able to remind me of the if
statements and the boolean expressions. By creating inequalities within the if statement I was
able to fix this and make the points change the image.

2c)

This algorithm is the one I used to make the points influence the game. It sets a variable
equal to a point value and the tells the program to hide one element and then show another.
This specific event is the first section of the program that tells the code to hide the image after
thirty three points are clicked. The abstract is the if statement within the onEvent statement.
This if statement states that IF the variable x equals thirty three points, then Image 1 should
be hidden and button 2 should become shown. This achieves the intended purpose of my
program by being the way you upgrade your fort. The only way for the game to be completed
is by this if statement setting limits on how high the score can go for each section.This
abstraction also uses logic by using the boolean expression >= which means less than or
equal to, so that there is a cap for each of the levels.

2d)

This abstraction helped manage the complexity of my code by allowing me to condense the
important part of my code into one function. All of the code that would affect the user’s
experience was within this section, and it made it very easy to duplicate. For there to be levels
and for each upgrade within the game to be different, these abstractions were duplicated and
then the numbers were changed; the first abstraction change when x was less than or equal
to 33, and then the increments went up by 33 from there. This sections uses math by finding
out the value of a variable that is x. That variable is the variable that tallies up the points and
makes them a total, while also keeping track of the amount to be able to hide the element
Image 1 and show the button 2. This abstraction also uses logic by using the boolean
expression >= which means less than or equal to, so that there is a cap for each of the levels.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy