# Indignant

Members

5

117 Neutral

• Rank
Newbie
1. ## Animating a wheel.

Hello! First of all, because here we are talking about a spinning wheel, we should probably describe initial speed as degree per frame. So, say if the initial speed is x degree/frame, the the speed in n th frame should be S(n) = x - a(n^2). To make the wheel spin, you just need to call the correct function to rotate the wheel object S degree every frame. Here is some pseudo code(display() is the disply loop that should be called in every game loop ): int frame = 0; double Si = 0; double S = 0; display() { //draw background if (S > 0) { S = Si - a*frame*frame; frame++; if (S > 0) { rotate S degrees; } } else { //end of game, call what you should call } swapBuffer(); } Just my two sents, maybe -a(x^2) is not a good option, because it causes the wheel to slow down faster at the end. In a wheel game like this, usually the last few seconds are the most exciting ones, so maybe you should simply use S(n) = x- a*n instead. int frame = 0; double S = 0; display() { //draw background if (S > 0) { S -= a; if (S > 0) { rotate S degrees; } } else { //end of game, call what you should call } swapBuffer(); } to start the spin, simply assign a value(the initial speed) to S. Hope your lucky wheel get you good luck! [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
2. ## How can I use Bullet to affect the graphics

Can any give some modified code? Many thanks!!!