Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Random Moving Algorithm

843789Jun 11 2010 — edited Jun 11 2010
Hello, I'm new to this Java Forum (and also in Java). I am working on a game applet and I need a random moving algorithm, that's what I've coded:
Random RGen = new Random();
PlayerX += RGen.nextInt(30);
PlayerY += RGen.nextInt(30);
It does nothing. I placed it in run(), and I also tried it as a function (as well called in run() ). Can someone help?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 9 2010
Added on Jun 11 2010
3 comments
108 views