when I press p the game does not pause and I do not know how to start a pause game with the space bar?
how can i display the score at the end?
col=color(57,185,247)
1) If the user presses the start key (the space bar), the game begins.
a) Use the arrow keys to move the worm up, down, left and right (extra feature: allow diagonal movement)
b) Press p to pause the game
c) Press q to quit the game
d) Press r to reset the game from the beginning (step 0)
e) Press the space bar to start a paused game.
3) if the worm eats the food:
a) The worm get bigger by one segment (extra feature: worms grows faster as the game progresses)
b) The food re-appears at a random location
c) The score is increased
4) If the worm goes off the screen or runs into itself, the user loses. Game over!
5) When the game is over, show the final score
Modify Program 1 so that the Zoog can be moved up, down, left, and right by pressing the corresponding arrrow keys. In addition, detect a least one other key depression by the user which acts like a toggle. The first key depression activating a visual change to the zogg and the second depression of the same key turning off the visual effect.
original:
size(200,200);
background(0);
ellipseMode(CENTER);
rectMode(CENTER);
//Zoog's body
stroke(39,242,29);
fill(255);
triangle(100,75,130,150,70,150);
//Zoog's head
fill(39,242,29);
ellipse(100,70,60,60);
stroke(127);
line(90,90,110,90);
//Zoog's eyes
fill(0);
ellipse(81,70,16,25);
ellipse(119,70,16,25);
//Zoog's Legs
stroke(255);
line(90,150,80,170);
line(80,170,90,120);
line(110,150,120,170);
line(120,170,110,120);