Welcome to my Programming Blog...

I am currently working on a couple of projects: An original game called "Implosion" which I am porting from Flash to the iPad, and a remake of Q*bert in Python (pygame), as part of the class I am teaching. Please feel free to use the "Labels" (at right) to follow a specific project or theme. If you are one of my Python students, I recommend that you check out the Python thread.

Sunday, May 2, 2010

Chain, chain, chain....

Some good success this weekend - I have gotten the chain of chips to work properly. Each chip is part of a sequence now. If one of the chips is removed, the ones past it glide in and replace it, and a new chip is dropped into the mix. (Your view is from above.) Here's a quick video - every time I click, a random chip is dropped:

The way this works is that each Chip has a "follower" and a "leader" - it is essentially a node in a doubly-linked list. Each chip also has two sets of coordinates - where it is now and where it is moving to, as well as a boolean that indicates whether it is in the process of moving. When a chip is removed, it sends its location to its follower, which uses it as its destination, and starts the chip animating. It also removes itself from the doubly linked list, as you would expect - tying its follower and leader together.

This is a major hurdle in the game, and one of the first things that looks great in OpenGL that I couldn't do with the Quartz commands - check out how the chips flip around as they fall away!

No comments:

Post a Comment