Forums Register Login

wanted help in the practice program--"Cycling"

+Pie Number of slices to send: Send
I made this code as a practice exercise......this program should be controlled with simply four
cursor control keys and each key must be assigned a method.....i.e., by pressing a particular
key some operation must be performed....what this program do is it should just reflects the changes in the distance traveled and speed of cycle by accelerating and decelerating the cycle and it should also change direction of the cycle(of course imaginary one since i haven't reached to the topics using graphics) .........as stated below

right cursor key(-->) : turnLeft().....and should change the direction as per the code
left cursor key(<--) : turnRight()....and should change the direction as per the code
up cursor key(<) : paddleMoving(int i)....here 'i' states for number of paddle rounds user
wants to apply which would be asked in the starting of the program
down cusor key : applyBrakes()......which eventually stops the cycle.

but the problem is that i dont know how to use Scanner for cursor keys...therefore i have left the class containing main() method.....Please help

>
+Pie Number of slices to send: Send
How are you planning to run the program? Swing or console? If console using Scanner to get inputs of what arrow keys are pressed? If Swing hence graphics ... KeyEvent will suit your needs.
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1008 times.
Similar Threads
Link two JPanel's with a line
Ball Physics implementation.
Null pointer exception thrown in paintComponent
abstract class
Hoe can i make the rat to move?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:24:29.