Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Works pretty well, and it's fun. It would be nice if the "bust" message appeared after all cards finished moving, rather than as soon as the final card begins moving to its destination.

Animating movement can be rather smooth on the iPhone as of 1.1.1 (check out the transitions on the Facebook iPhone site, for example). Looking at your animation function, I think your main performance bottleneck is centered around the number of parameters in your animation function, particularly that you build a string out of so many pieces in the setTimeout call.

The way I handle animations is to have a global array of animation objects ('object' being just an associative array). These animation objects contain what would be all the parameters that you pass to this function. If you do that, the animation function itself no longer needs to take any parameters. Any time it is invoked, it increments all animations in the animation list, then sets a timeout to activate itself again if there are still animations that aren't done yet.

I just figured I would say that in case you were interested. If you're satisfied with the performance of the animations, please just disregard what I said.

I have to admit I'm kind of worried about the total lack of replies this thread has gotten since it was created. I hope it's not indicative that nobody cares about web-based games anymore, particularly because I'll be announcing one I've been working on soon, and it's no small game. I would hate for it to not be noticed at all.
 
Works pretty well, and it's fun. It would be nice if the "bust" message appeared after all cards finished moving, rather than as soon as the final card begins moving to its destination.

Animating movement can be rather smooth on the iPhone as of 1.1.1 (check out the transitions on the Facebook iPhone site, for example). Looking at your animation function, I think your main performance bottleneck is centered around the number of parameters in your animation function, particularly that you build a string out of so many pieces in the setTimeout call.

The way I handle animations is to have a global array of animation objects ('object' being just an associative array). These animation objects contain what would be all the parameters that you pass to this function. If you do that, the animation function itself no longer needs to take any parameters. Any time it is invoked, it increments all animations in the animation list, then sets a timeout to activate itself again if there are still animations that aren't done yet.

I just figured I would say that in case you were interested. If you're satisfied with the performance of the animations, please just disregard what I said.

I have to admit I'm kind of worried about the total lack of replies this thread has gotten since it was created. I hope it's not indicative that nobody cares about web-based games anymore, particularly because I'll be announcing one I've been working on soon, and it's no small game. I would hate for it to not be noticed at all.

Thanks for the feedback. I recently changed the "winner" announcement to happen after the cards finished moving, and was trying to decide whether i cared enough to deal with the "bust" (I probably do :)

As for the animation, I do it your way (global sprite list) for more complicated games, but I figured the card movement is smooth enough (considering how short the travel distance is and how fast it happens). I may play around with it a bit and try to smooth it out some more. Not sure. I am a C++ programmer, so I'm not familiar with javascript optimization.

As for your other point: yes, there is a definite lack of interest in web-based games, which is why I stopped working on them for awhile. I did this one only because someone requested it, and I figured if a few hours of my time makes someone happy, good enough.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.