clintbellanger / Karma-Slots

Simple HTML5/js/canvas slot machine game
http://clintbellanger.net/karma/
184 stars 87 forks source link

controlling acceleration and maximum speed #3

Open FlorianTopf opened 11 years ago

FlorianTopf commented 11 years ago

Hi,

I'm currently playing around with the karma slot machine and I tried to lower the spinning speed. After the change, the reels don't seem to trigger a stop at maximum speed. Could it be, that the spinning speed max is tied to another parameter?

clintbellanger commented 11 years ago

Taking a look at code now. Did you happen to set the new max_reel_speed to an odd number? I notice that reel acceleration is +2, so it never is an odd number. And the stopping mechanism expects an exact match.

Line 236 should probably be

 if (reel_speed[0] >= max_reel_speed) {

Try that to see if it helps.

FlorianTopf commented 11 years ago

It certainly does the trick, when you want to use odd numbers, which I didn't try originally. I set the speed to say 16. This seems to break the spinup mechanism. A a certain point it does not increment the speed anymore (or sometimes it does but not regularly), hence not reaching maximum speed.

I checked my code several times to be sure not having broken the original program procedure. Maybe there is a need (at least for me) to rewrite the spinning mechanism to be more flexible. Do you have any idea, why setting lower even maximum speed breaks the logic?