var startScreen = new Text(“Welcome to a speed game! Click space to see the rules “, “13pt New Times Roman”);
var rulesPart1 = new Text(“The goal of the game is to click on every number from least to ” , “11pt New Times Roman”);
var rulesPart2 = new Text(“greatest with your mouse. You will have the time it took to” , “11pt New Times Roman”);
var rulesPart3 = new Text(“complete the game at the top left corner if you decide that” , “11pt New Times Roman”);
var rulesPart4 = new Text(” you want to beat your previous score, please tap” , “11pt New Times Roman”);
var rulesPart5 = new Text(“the F button to start the game” , “11pt New Times Roman”);
var nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
function start(){
startScreen.setPosition(getWidth() / 2 – startScreen.getWidth() / 2, getHeight() / 2);
add(startScreen);
keyDownMethod(titleScreen);
//set rules for how they lose/finish
//start the speedGame
}
function titleScreen(e){
if (e.keyCode == Keyboard.SPACE){
removeAll();
rulesPart1.setPosition(getWidth() / 2 – rulesPart1.getWidth() / 2, getHeight() / 2 – 40);
add(rulesPart1);
rulesPart2.setPosition(getWidth() / 2 – rulesPart2.getWidth() / 2, getHeight() / 2 – 20);
add(rulesPart2);
rulesPart3.setPosition(getWidth() / 2 – rulesPart3.getWidth() / 2, getHeight() / 2 );
add(rulesPart3);
rulesPart4.setPosition(getWidth() / 2 – rulesPart4.getWidth() / 2, getHeight() / 2 + 20);
add(rulesPart4);
rulesPart5.setPosition(getWidth() / 2 – rulesPart5.getWidth() / 2, getHeight() / 2 + 40);
add(rulesPart5);
} else if (e.keyCode == Keyboard.letter(‘F’)){
speedGame();
}
function speedGame(e){
removeAll();
makeRandNum();
mouseClickMethod(disappearNum);
/*delay and make user tap a button to create image where user needs to move around with
keysticks and press space by number order*/
}
}
function disappearNum(e){
}
function makeRandNum(){
for(var i = 0; i < nums.length; i++){
var curNumbers = new Text(nums[i]);
var pastNumbers = new Text(nums[i] – 1);
curNumbers.setPosition (Randomizer.nextInt(0 + curNumbers.getWidth(), getWidth() – curNumbers.getWidth()) , Randomizer.nextInt(0 + curNumbers.getHeight(), getHeight() – curNumbers.getHeight()));
pastNumbers.setPosition (Randomizer.nextInt(0 + pastNumbers.getWidth(), getWidth() – pastNumbers.getWidth()) , Randomizer.nextInt(0 + pastNumbers.getHeight(), getHeight() – pastNumbers.getHeight()) );
curNumbers.getX() != pastNumbers.getX()
curNumbers.getY() != pastNumbers.getY()
add(curNumbers);
}
}
This is the code that I have so far, however feel free to correct anything if needed. I want to have the user go through the numbers from least to greatest and click them, making them disappear. There should be a timer that will end once they make all the numbers disappear. In addition, I would like an end screen along and please make sure the numbers 1-20 don’t overlap. I am willing to pay more if the code is done soon and all the functions work properly (this is a project for CodeHs)