Friday, October 29, 2010

TIGjam Day 1 and learning Flash and Flixel

So, I went to the first day of tigjam 3 today! It continues tomorrow and all through the weekend. Pictures and stuff later; for now, I just want to talk about what I've learned so far.

I started learning flash just a few days ago. That may seem like not very much time, and while I haven't made that many games in my lifetime, I have used a brand new technology for just about every game, so I should be pretty good at learning this stuff. (Some games I've made organized by tech: c++/opengl, assembly, python/pygame, java/home brew game engine, python/twisted/mysql/shell scripts/php/an entire cluster of machines)

The setup for today:
Language in: actionscript3
IDE: flash builder 4
Extra libraries: flixel (http://flixel.org/)
Flavor of computer: mac

As it turns out, Flixel has a lot of the elements I saw before in PyGame and even ODE. There is a main event loop, and some combination of 'move objects', 'detect collisions', 'get user input', 'draw stuff to the screen' happens each timestep.

As I acquired more and more skills throughout the day, I made two not-really-games which are not even worthy of posting online, but which I'll show you pictures of. The first game was Pong, because I knew undergrads at my school in a games capstone class started out with Pong. I got on screen text, moving paddles, a particle emitter, "scores" (score a point for hitting the ball with the paddle)... and then I got bored and moved on to other things.



The second non-game involved an animated sprite (and sprite sheet), keyboard controls again, and drawing a trail behind the player as it moved. You could basically get this little guy that wiggled his arms to skate around the screen an occasionally drift off and be lost forever.


Lessons learned:
- Oh my god don't forget to add "super.update()" in the appropriate places. Why doesn't collision work? Why isn't my sprite at the right place? Why do I have to update each sprite manually? All questions that are answered with a well-placed super duper super.update().
- Animated sprites are pretty easy.
- Particle effects are really easy.
- IF you used loadGraphic to get an image into your sprite and set the reverse argument to true, THEN you can say "facing = FlxSprite.LEFT" to change the direction of your sprite at your discretion.
- You can draw things (sprites, shapes) or a trail of things to the screen by making a big, transparent sprite the size of your game and then saying hugeSprite.draw(testSprite,x,y),  permanently rubber-stamping the smaller sprite into the huge sprite.

Sleeping now... more games tomorrow!

No comments:

Post a Comment