Discussion:
How to use keyevent for Radar Movement
asherbaig
2008-12-04 16:51:30 UTC
Permalink
Hi,
I have made my robot where i defined keys for power button instead of
using Mouse movement.

But i am facing problem with radar.How to set my radar to use buttons
key for example


if pressed Vk_U = move 180 degree clockwise
if pressed Vk_I = move 180 degree Anticlockwise


Please need suggestion for developer.





------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Robocode/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Robocode/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:Robocode-***@yahoogroups.com
mailto:Robocode-***@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
Robocode-***@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
flemmingnlarsen
2008-12-04 23:47:22 UTC
Permalink
You can have a look on the sample.Interactive robot available in
Robocode. You could copy this robot in order to create your own version.

Then, in the very end of the onKeyPressed(KeyEvent e) you insert these
lines:

char c = e.getKeyChar();
if (c == 'u') {
setTurnRadarLeft(180);
} else if (c == 'i') {
setTurnRadarRight(180);
}

Voila!

Best regards,
- Flemming
Post by asherbaig
Hi,
I have made my robot where i defined keys for power button instead of
using Mouse movement.
But i am facing problem with radar.How to set my radar to use buttons
key for example
if pressed Vk_U = move 180 degree clockwise
if pressed Vk_I = move 180 degree Anticlockwise
Please need suggestion for developer.
------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Robocode/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Robocode/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:Robocode-***@yahoogroups.com
mailto:Robocode-***@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
Robocode-***@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
asherbaig
2008-12-05 18:01:44 UTC
Permalink
Thanks for the TIP.

I don't understand that its a bug or i did something wrong that

i implemented your code and when i pressed U it radar moves.But
as i deleted this code to check that U button is disable or not.

It shows me button U is not disable.

The button is still working.

I run cachecleaner in robocode even than it shows me that button U is
working when i pressed U.

Deleting roborumble/temp... done.
Deleting robots/.robotcache... done.
Deleting robots/robot.database... done.
Creating roborumble/temp... done.
Rebuilding robot database... Building robot database.
done.

Also when i check CacheCleaner.java there i found not is use the
following import
import robocode.control.RobocodeEngine;

Whats wrong there or its a bug ?
Post by flemmingnlarsen
You can have a look on the sample.Interactive robot available in
Robocode. You could copy this robot in order to create your own version.
Then, in the very end of the onKeyPressed(KeyEvent e) you insert these
char c = e.getKeyChar();
if (c == 'u') {
setTurnRadarLeft(180);
} else if (c == 'i') {
setTurnRadarRight(180);
}
Voila!
Best regards,
- Flemming
Post by asherbaig
Hi,
I have made my robot where i defined keys for power button instead of
using Mouse movement.
But i am facing problem with radar.How to set my radar to use buttons
key for example
if pressed Vk_U = move 180 degree clockwise
if pressed Vk_I = move 180 degree Anticlockwise
Please need suggestion for developer.
------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Robocode/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Robocode/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:Robocode-***@yahoogroups.com
mailto:Robocode-***@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
Robocode-***@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Loading...