Hey guys... i'm trying to add difficulty into my game, but even though i get no errors or anything else, it seems not to be working. Here's my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; /** * Write a description of class Instructions here. * * @author (your name) * @version (a version number or a date) */ public class Instructions extends Actor { public Instructions() { setImage ( new GreenfootImage( "Difficulty levels: Justin Bieber (e), Normal (n), INSANE!!! (h)" , 50 , Color.RED, Color.GREEN)); difficulty(); } public void difficulty() { if (Greenfoot.isKeyDown( "e" )) { Greenfoot.setSpeed( 40 ); } else if (Greenfoot.isKeyDown( "n" )) { Greenfoot.setSpeed( 50 ); } else if (Greenfoot.isKeyDown( "h" )) { Greenfoot.setSpeed( 60 ); } } } |