i've made most of the logic for my 'block based game' upon my Background class, which is a subclass of world.
I tryed this code out:
if(Greenfoot.mouseClicked(this))
{
CurrentShape.moveRight();
}
which worked fine, but obviously using the mouse to move right isn't ideal so i tried loads using the keyboard, particularly the one which is actually given in the programmer manual (http://www.greenfoot.org/doc/manual.html#keyboard)
if(Greenfoot.getKey().equals("space")
{
some code here
}
but it just keeps giving me a NullPointerException pointing to the getKey line of code. help?
![Twitter](/assets/twitter-4e19209ef84344ee0c433f4c7bad8d49.png)
![Twitter.hover](/assets/twitter.hover-1fb19a5bafc50deace8f88eaec867845.png)