Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Game development on J2ME

 
James, Tan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
My name's James and I'm developing a game that requires a player to remember a sequence of images randomly generated by the program.
i.e : When the game starts, an image of 3 different images will show sequentially on a second, and then the user will be prompt to remember that exact sequence of images.
My problem is : How do I write the program so that it would:
1. Generate any random images from a list of 12, starting with 3 images.
2. Compare the selection made by the player with those that the program generated in the first instance and then verify its validity.
3. Add 5 points to the user's score for every successful attempt, no point for an invalid attempt.
I would appreciate any help from all you ranchers out there...Thank you.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the MIDP docs it appears you will be able to use the java.util.Random class to do the random selection.
java.util.Vector will do to hold the displayed items or you could use an int array.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!