Nothing happening with KeyPressed
-
import java.util.*;
import processing.core.*; -
public class Monopoly extends PApplet
Yet nothing is happening. What did I do wrong?
{
PImage img;
public void setup()
{
size(687, 807);
img = loadImage("monopoly.jpg");
PFont font;
font = loadFont("BankGothic-Medium-48.vlw");
textFont(font, 32);
}
int x = 1;
boolean turn = true;
int score = 0;
int roll;
int num, num1;
public void draw()
{
noLoop();
Random rand = new Random();
num = rand.nextInt(6)+1;
num1 = rand.nextInt(6)+1;
roll = num + num1;
background(0);
image(img, 0, 100);
text("Money: " + score, 0, 32);
if (turn == true)
{
text("Turn = User", 0, 64);
}
else
{
text("Turn = Computer", 0, 64);
}
text("Roll: " + roll, 0, 96);
text("Press Enter to continue!", 200, 32);
}
public void KeyPressed()
{
if (keyCode == ENTER && x < 20)
{
println("hree");
if (turn == true)
{
turn = false;
redraw();
}
else
if (turn == false)
{
turn = true;
redraw();
}
}
else
if (keyCode == ENTER && x >= 20)
{
text("I said ENTER knucklehead!", 200, 64);
}
}
}