|
Post by jonneymendoza on Sept 5, 2007 3:18:05 GMT -5
Hi i am currently working on a roulette game for the mobile phone and was wondering if you guys can generate some tips and ideas for me seeing has i am working on this on my own Cry
whats the best approach in navigating around the roulette table using a cursor hand? i have already written down all co ordinates on where the cursor will be in each position but i cant figure out how im going to move the cursor around in the most easiest way.
i was thinking of defiing x and y variables and that each time the user presses the directional button it will increase or decrease the x y. i would then store the co ordintes in some sort of 2d array where if point(x,y) = highlight this area, make all area's inactive?
Also does anyone know any suitable methods of rotating the roulette wheel and making the ball randomly bounce into the correct value? the game is connected to a server in real time that sends me the winning value and i then have to figure out a way to make the ball end up in the correct value in the wheel itself.
at the moment i have the entire wheel has one image but i am thinking of creating a film strip of say 8 frames of the wheel in different angles.
the numbers will already be inside the wheel as one image. i was thinking storing the positions of each number via x and y in an array but if i change the position or size of the wheel, the x and y co-ordinates will be incorrect again.
another way is to create the numbers individualy and apply 8 frames to a film strip to indicate the angle rotation of each number but then again these numbers have to be positions correctly in the wheel.
i am looking for the best and easiest solution i can find to achieve this. has you mentioned i may rotate the the ball around the wheel using x and y co ordinates.
thanks for your suggestions
|
|
|
Post by Adam Schmelzle on Sept 5, 2007 8:49:02 GMT -5
Hello again! Here's a snap from an NES game called 'Vegas Dream' that uses a cursor to place bets, and it works quite well. When you are moving the cursor, it jumps between the proper betting locations, so you can move between the betting positions very quickly, and it's obvious what is going to be selected if you press fire... Is this your first animated J2ME application? Before we figure out how the ball is going to end up in the rights spot, lets see if we can pin down how the wheel is going to look. Once that's done, we just add the ball. So if the entire wheel is visible with numbers and all.... If you use a film strip as you mentioned, the wheel will only be able to have 8 or so images as mentioned, or you may start running out of memory depending on the size of the images. If you've only got say 8 images, the animation will only seem smooth while the wheel is turning quickly, and appear to stop/jerk when it slows down. It's too bad there aren't any nice fast native image rotating abilities in J2ME. I think you may need to just do a zoomed in view of the wheel while it is spinning. Here's what the NES game looks like... When the wheel is spinning at the start, it shows an animated wheel, but it's only a few frames repeating, with a ball going around... When the wheel slows down, it shows an animated zoomed in view, with the numbers visible, and the ball bouncing... I checked this game on a whim, just to see what they were doing, and it's just about exactly what I was thinking anyway.
|
|
|
Post by jonneymendoza on Sept 6, 2007 3:09:51 GMT -5
thanks i have done the cursor method for the betting table and for the wheel i created 37 images in a filmstrip. its smooth and works fine on my N95 but like others have said it may not be compatible for older phones due to out of memory issues has you and others have mentioned. i have got the close up bit animating well using a filmstrip containing the numbers and then using drawRegion to draw an area of it each time
|
|
|
Post by Adam Schmelzle on Sept 6, 2007 7:55:15 GMT -5
Glad you got it all worked out!
|
|
|
Post by jonneymendoza on Sept 7, 2007 3:00:19 GMT -5
yup yup the next step is to figure out how to drop the ball into the correct slot in the wheel
|
|
|
Post by Adam Schmelzle on Sept 7, 2007 9:07:24 GMT -5
Dropping the ball should be simple. You already know the final position, so I'd simply hav the ball always travel the exact same distance in the animation, and just adjust what numbers the zoomed in view starts at....
Example: final position = #32, assuming we only show the last 20 numbers before the ball stops
Start the animation at 19 positions before the number 32, so #5 is our first number in the animation. Now just show the ball bouncing in the middle of the animation, and scroll all the wheel positions past underneath the ball.... #24, #16, #33...... when we get near the end, stop the ball when #32 goes by: which is always 20 positions since we started the animation, and you are done!
To figure out the starting index, simply use modulous... If your wheel has 37 positions, and the final resting point is the 7th position(index 6), the start of the animation is at.....
[ (6 + 37) - 20 ] % 37 = 23 [ (startIndex + wheelSize) - animationLength] % wheelSize = animationStartIndex;
If your animation lasts longer than the length of the wheel, simply add any multiple of the wheelSize as long as it's bigger than the length of the animation...
[ (startIndex + (wheelSize*10)) - animationLength] % wheelSize = animationStartIndex;
I hope this helps.
|
|
|
Post by kiechb on Jan 11, 2008 15:33:40 GMT -5
It would be a lot cooler if the ball spun and stopped randomly, maybe by using physics similar to ABP.
Of course, the number of players that would appreciate it? Who knows...
|
|