Processing
Holy crap is this cool!
Knowledge Management > Learning Strategy > E-Learning > Flash
{ Category Archives }
Holy crap is this cool!
I was away learning about Knowledge Management this week, which will occupy several blog entries as what I learned from this conference experience relates directly to the purpose of this site.
But, I also wanted to let you know how easy it is to use classes that other people author.
As you can see, I have collision detection working. And I barely wrote any code. In fact the class that runs this is directly from Grant Skinner, who released his ProxmityManager class on his site back in February. After reading Branden Hall’s blog using the same methodology as far as dividing the screen into a grid, and then, when the ship is in a particular block, it checks the neighboring blocks for asteroids.
Download the source files for yourself and check out Grant’s and Branden’s blogs for yourself.
So I didn’t expand on the interaction between the ship and the asteroids. Instead, I tooled around all weekend trying to create randomly shaped polygons to use for the asteroids. This is something I wanted to do in the original build and never took the time to concentrate on the problem.
I read several articles online. Looked at academic research on a Random Polygon Generator. The algorithms were mind boggling. I e-mailed some very smart ActionScript programmers for some help. None came (at least by the time of this writing).
Then it occurred to me… can’t I just rotate similar-sized squares and triangles appearing randomly to produce a randomly shaped polygon? Bet your ass I could
So this release marks two changes that are related. One is the obvious — randomly shaped asteroids for a more unique experience. Continue Reading »
It would figure that success breeds more success, and now I have a ship that flys about the screen using the arrow keys, again controlled via a Ship class. Try it for yourself right here!
With a taste of success under my belt, I started remaking the Asteroids game using ActionSctipt 2.0 and class structure.
While the Asteroids you see here are movieclips with polygon fills, unlike the completely code-rendered Asteroids in the original game, there is no code in the entire flash movie. All the code takes place in the Asteroid.as class file that each Asteroid movieclip is bound to. I didn’t even have to instantiate these Asteroids for them to behave. I just drag them out of the library and let them do their thing. Continue Reading »
Starting from scratch at understanding just how Object-Oriented Programming, ActionScript 2.0 models inside of Flash. I took a stab at what Grant Skinner spoke about at FlashForward 2005 in San Francisco (last week). Here’s the finished product…
Grant’s a pretty smart guy. Sure the example he wrote above isn’t terribly sexy, but Grant revealed a key element in how to conceive of OOP in a way that bridges most developers’ understanding of Flash and very evident objects — associating movieclip behaviors with a class that describes the behavior.
I’m going to journal these experiments, working my way up to rebuilding my (somewhat famous) Asteroids code with ActionScript 2.0.
But for now, let’s get back to the basics…
Directly associating Classes to movieclips isn’t the only approach you can use in grasping OOP with ActionScript 2.0, but it’s a great start for understanding how theoretical object structures can relate to the virtual objects that you can manipulate in Flash’s IDE. Continue Reading »