Im currently doing a project for my university, i already made a playable game but i also want the user to write, kinda like making the user call the correctly functions to make my character move, is there anyway to do it?
private String input = "";
public ClassName()
{
updateImage();
}
public void act()
{
String key = Greenfoot.getKey();
if (key != null)
{
//check for special keys like space, backspace, escape, ...
if ("space".equals(key)) key = " ";
//…
input = input + key;
updateImage();
}
}
private void updateImage()
{
//create an image, draw the String input on it
}