This site requires JavaScript, please enable it in your browser!
Greenfoot back
Green101
Green101 wrote ...

2012/2/29

Automatic keypressing

Green101 Green101

2012/2/29

#
This may seem like a really stupid question but my brain just isn't working! I have a working game which acts on key presses. Is there anyway i can get greenfoot to "push" a key as it where. For example drawing a pattern for the user to copy. So use the keys W, S, A , d to draw an image on its own.
danpost danpost

2012/2/29

#
Do you mean like, set up a boolean to track whose turn it is to draw (maybe called 'iaTurn'), and if it is false then get keystrokes from the keyboard and if it is true get characters from a list (or something like that)? If that is what you were looking for, you will need one more boolean to track 'iaIsDrawing' and a String to hold the last 'iaChar' and an integer to count down the time the "key is held down".
You need to login to post a reply.