September 18, 2007
Springing into ActionScript
My fingers on my left hand are now semi-operational. I can curl my middle finger about half way, enough to wrap it around large objects, but not enough to make a clenched fist. I can also write legibly now if I don’t put too much pressure on the pencil and I use large letters. It’s not healed enough for extended writing, but at least now I can jot things down as I work on a computer. I’m also speeding up with nine fingered typing, so that’s a bonus.
As I doubt my hand will be healed enough for fine pencil work for a while, I’ll dedicate this work to keyboard only tasks. From the perspective of game development, this means I’ll have to continue holding back learning Illustrator and Flash animation a while longer. I could just use geometric shapes with the mouse I suppose, but I’d prefer doing draft work with pencil (either real or digital), and I think it’s best to wait a bit before putting too much pressure on my swollen finger. Instead this week I’ll continue to get to grips with ActionScript 3.0.
So far my progress has been slow; I’ve been tired out by the time I crack open the laptop for learning ActionScript, so I haven’t been in the best frame of mind for grasping the basic concepts of the language. It’s been a while since I’ve picked up a new language, and while I know a moderate amount of C++ I don’t have much of a foundation in JavaScript or more modern object-oriented languages which I believe ActionScript 3.0 has taken some inspiration from.
I’ve been typing in a few examples from Foundation ActionScript 3.0 Animation - Making Things Move! by Keith Peters, but I’m not sure if this is the best approach to learning. While I understand the basic examples in the first few chapters, he doesn’t go into much depth into the underpinnings of the language before he veers off into basic trigonometry and working towards basic physics; stuff I’m already pretty versed in and which doesn’t strike me as very language specific.
Also since the book is aiming for developers using Flash or Flex the content appears to mostly ignore the Flash CS3 authoring environment. Learning pure AS3 (ActionScript 3.0) is useful, but for the sorts of apps and games I am starting with my feeling is that it should be much simpler to put together the basic building blocks in Flash. Animating sprites for example is a no-brainer, and positioning text elements is a lot easier with a GUI than in code. This isn’t a knock on the book, but my feeling is I should learn how to best integrate Flash with AS3 as I learn the language to speed up development.
I’ve also been looking at a few on-line tutorials, but nearly all of them seem to be based on ActionScript 2.0 programmers moving to the new language. My feeling is that these rely too much on Flash, and a lot on hacking together old ActionSctipt paradigms with the new 3.0 model. Most for example put code on the Flash animation timeline (for non-Flash programmers, you can put scripting commands on each frame of a Flash animation). I don’t know if this is a decent practice to get into as I don’t know enough about Flash development; my gut reaction is that frame-based scripts are good for simple code needed to manage an animation, but for anything complex (to which anything resembling a game qualifies) it’s better practice to write your code as separate scripts.
My current goal is to work my way up the standard hierarchy of beginner games to get an idea of how everything ties together. Although my time is pretty limited I should be able to get one done every week, at least.
For now though, I’m still skimming through Adobe’s own Flash docs and examples to get a better understanding of the core of the language and the recommended programming practices involved. My reading of AS3 is that it is very highly object-oriented, which suggests to me a well ordered structure of object classes is the most sensible approach to building a Flash app. However I think I need to read and play around with more sample packages, namespaces and the like to get a better idea of how eveything ticks.
I’ve also got a copy of ActionScript 3.0 Game Programming University
by Gary Rosenzweig on order from Amazon. Publishing was delayed but I’ve had word it’s shipped, so it should arrive within a fortnight. I’m not sure how useful it will be until I get a better look inside, but the list of contents suggest it shouild be a useful resource for learning the basic mechanics for any single-player type Flash game I’d like to make. It seems to be missing anything involving client-server communication, which is something I may like to look into in the future given the web like nature of Flash, but for now it seems perfect learning material.
Hopefully I can get to speed pretty quickly. From what I see you can put together simple games with a very small amount of code in Flash and ActionScript, and it’ll be great to be able to throw together ideas in a matter of days rather than months.