Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Adam Atomic

Pages: 1 2 [3] 4 5
help / FlxKong - a wrapper for the Kongregate API
« on: Wed, Sep 2, 2009 »
Ok so here is the FlxKong file contents:

Code: [Select]
package com.adamatomic.flixel
import flash.display.DisplayObject;
import flash.display.LoaderInfo;
import flash.display.Loader;
import flash.display.Sprite;

public class FlxKong extends Sprite
public var API:*;

public function FlxKong() { }

public function init():void
var paramObj:Object = LoaderInfo(root.loaderInfo).parameters;
var api_url:String = paramObj.api_path || "";
//FlxG.log("API path: "+api_url); //DEBUG

//Load the API
var request:URLRequest = new URLRequest(api_url);
var loader:Loader = new Loader();

private function APILoaded(event:Event):void
   API =;;


Pretty small!  But how do you use this thing?  It's really, really easy once you initialize it.  The safest place to initialize it, to make sure that it is able to load the API properly, is inside the update() override of your first game state.  In my games this is usually or something along those lines.  At the top of your update() override, include this line of code:

Code: [Select]
if(!FlxG.kong) (FlxG.kong = parent.addChild(new FlxKong()) as FlxKong).init();
This will initialize the FlxKong wrapper and make sure it is able to load the API without flipping out on you.  So that was easy!  Now you have the whole Kongregate API at your fingers; how do you use it?  Well I can't go into the finer points of how the Kong API works on the whole, but basically this is the only other line of code that I have in the Kong build of Canabalt, and it handles ALL of the high score stuff:

Code: [Select]
FlxG.kong.API.stats.submitArray ( [ {name:"Best Run", value:distance},
{name:"Total Distance", value:distance},
{name:"Last Time", value:_epitaph},
{name:"Body Count", value:1}] );

That's it!  I call that when the player dies.  Notice how the submitArray() call is buried inside this?

Code: [Select]
That's so all you have to do to turn off Kongregate statistics in any given build of your game is just comment out the initialize line from your initial game state.  If you never initialize it, it will stay null, and the reporting code won't run!

It's really easy to add high scores and other stats to your game this way, and it will make a big difference to the Kongregate players.  Obviously this will be included in the next public, I just thought since it was easy to share and pretty useful I'd get it out here earlier.  Have fun!

DISCLAIMER: Obviously this will only work if you submit your game to Kongregate, but they welcome free game submissions and have a good revenue sharing gig going on.

chat / General updates and crapppp
« on: Mon, Aug 31, 2009 »
Hey flixelers...flixelites?  Hmmm

ANYWAYS just a few updates or whatever:

1: Obviously flixel could use a small update.  There are some bugs and some omissions that are not the best.  However, due to my work schedule and the upcoming September Madness (conferences, film festivals, trips, etc) there is a good chance that we won't see a major update until *gasp* October.  However I will try to make it EXTRA SEXY when I do get around to putting it together.  I have some good fixes planned!

2: Between Canabalt and Ludum Dare this weekend it seemed like a good time to beef up the frontpage gamebox and make a dedicated link for it:

If I put your game up there and you're all like "WHAT eeewww take it down" then just let me know!

3: The workshop is full already BUT hopefully the Library's wifi will be good enough to do a live UStream of the event, I'll work on figuring that out over the next few weeks.

I think that's about it!

games / Canabalt
« on: Mon, Aug 31, 2009 »

I am exhausted.  Danny B on the music (as usual!), and special thanks to Steve Swink and Ben Ruiz from Flashbang for hashing out ideas and playtesting!

chat / Silence, Lack of Progress, etc
« on: Mon, Aug 17, 2009 »
Hey guys!  Just checking in to let you know that I'm kind of crunching on day job stuff right now, but I'm looking forward to kicking out a small update in a few weeks (maybe in time for the workshop?).  I have some tilemapping bugs and some other stuff that I'd like to get in there - it may not be the full-on v1.3, but I think it might be helpful still.

Also we are figuring out a good way to make the tutorial that SieferTim and DarthLupi have put together into something a little more official and obvious, it's a pretty amazing resource.

That's about it!  Carry on :)

help / Mario style jumps
« on: Sun, Aug 16, 2009 »
Some sample code about how to do the classic "the longer you press jump the higher you go" platforming leap.  First you should initialize maxVelocity.y and acceleration.y to some reasonable number in your constructor:

Code: [Select]
acceleration.y = 1200;
maxVelocity.y = 300;

Then, you need to add this processing code to the update() function:

Code: [Select]
if((_jump >= 0) && (FlxG.kA || FlxG.kB))
_jump += FlxG.elapsed;
if(_jump > 0.25)
_jump = -1;
_jump = -1;
if(_jump > 0)
if(_jump < 0.065)
velocity.y = -180;
velocity.y = -maxVelocity.y;

"_jump" should be a member (with type "Number") of your class, but it doesn't need to be initialized.  Basically this code will change how high the player jumps depending on how long you hold the jump button...the minimum jump strength is 180, and it maxes out at 0.25 seconds of holding.  Don't forget to call super.update() afterward!

Finally, you need to override hitFloor to reset _jump:

Code: [Select]
override public function hitFloor():Boolean
_jump = 0;
return super.hitFloor();

That's it!

chat / workshop is go!
« on: Thu, Aug 6, 2009 »

chat / T-Shirts for the flixel workshop
« on: Fri, Jul 31, 2009 »



Slowly cobbling together relevant details for the workshop, it looks like probably the evening of September 14th, 2009, here in downtown Austin.  I wanted to get some input on what shirts you guys thought were the most rad though!

chat / fixed up the general help resources thread
« on: Tue, Jul 21, 2009 »
I found a great actionscript tutorial, added a kind of rough overview of what flixel even IS, linked to some articles i've written, a few other things - also linked it off the main page (instead of linking to nanodoc):

Hopefully this will field questions a bit better!  I'm gonna make some little badges and jam those in there too

help / What is flixel?
« on: Tue, Jul 21, 2009 »
What is flixel?

flixel is a free Actionscript (Flash) library that I distilled from a variety of Flash games that I've worked on over the last couple years, including Gravity Hook and Fathom.  It's primary function is to provide some useful base classes that you can extend to make your own game objects.

For example, provides a basic game object that includes global volume control and a way to manage gameplay states. provides a bunch of collision code, velocity and acceleration options, and an optimized render path (approx. 10x faster than the normal Flash vector renderer). provides a class for quickly and easily creating cool particle effects.

flixel comes with full documentation for the API and a sparsely commented example game, free for partial, full, personal and commercial use.

Click here to play a bunch of games made with Flixel!

Some of flixel's native features include:

Really fast renderer (5000+ sprites on modern PCs)
Particle systems
Global volume control with hotkeys
Parallax scrolling (free/multi-directional)
Fullscreen mode (BETA)
Collide sprites against almost anything (box only, but you can add circular or custom)
Text rendering
Retro style zoomed rendering options (2x pixels, 3x pixels, etc)
Does not require the Flash IDE, works best with free tools like FlashDevelop
Organizational classes like game states
Simple buttons
Utilities for looping music and playing sound FX
Simple special effects like screen flashes and fades

Who can use flixel?

Anybody!  flixel is released with the MIT License, which as far as I understand it means you can use any of these files for anything you want, commercial or not.  You only need to redistribute the license if you are redistributing source code that includes any of my work, because the license has that clause for like "if this messes up your computer then you can't blame me" or whatever.

Can I use X, Y or Z flash modules/plugins/classes/extensions with flixel?

As far as I know, yes.  As long as they are Actionscript 3 compatible, they should work fine.  If they are based on Movieclips instead of Sprites, you may have to do some fiddling, but flixel is just a framework that sits on top of flash.display.sprite, so you can do pretty much whatever you want (including using normal Flash widgets like text inputs, etc).

Special Thanks to...

Ivan Safrin created nanodoc, tested flixel, and a couple years ago taught me Actionscript.

Danny B created all the music for Gravity Hook, Fathom, and Mode, and he also created the signature flixel logo riff.  One of the few humans I can stand to collaborate with!

Bekah is my oh-so-hot wife, who for some reason tolerates the insane amount of free time that I spend making games, and was especially cool about The Flixel Weekend, where I built all of v1.0 and mode in about 2 days.

Farbs explained how to get rid of some really nasty hacks in the flixel code.

Obviously big thanks to the flixel community for all the feedback, bug checks, suggestions, tutorials, and good vibes.

chat / v1.25 is ready for testing!
« on: Sat, Jul 18, 2009 »

Many thanks to flixel community member Nitram_Cero for the many
suggestions, and to indie dev Farbs for helping me take out the
"stupid giant invisible textbox" thing :)

> Buttons no longer briefly appear anchored in the upper left corner
> Fixed FlxTilemap collisions with non-0,0 position
> Fixed FlxTilemap rendering issue with unbounded camera
> FlxCore moved out of data to main folder
> Stupid giant invisible textbox no longer required for focus control
> Moved collide() into FlxCore
> Moved collideArray/s() and overlapArray/s() into FlxG
> collideArray/s() and overlapArray/s() self-check now
> Added onEmit() function to FlxSprite
> Optimized FlxSprite rendering a bit
> Fixed bug in per-pixel overlapPoint()
> Added alpha to FlxSprite (without falling back on vector renderer!)
> Added scaling to FlxSprite (display only, bounding box must be scaled manually)
> Fullscreen mode (BETA): Esc to toggle, TAB for Button A, SPACE for Button B
> NOTE: Fullscreen mode requires special "allowFullScreen" HTML property
> FlxSprite's facing variable uses getters, setters and consts now!

this is silly and should be remedied asap

not sure what the deal is, that dude's test game is messed up tho:

releases / v1.21 - button drawing bug
« on: Fri, Jul 17, 2009 »
Buttons briefly appear anchored in the upper left corner when you load a new state

chat / 403 Forbidden, Long load times
« on: Tue, Jul 14, 2009 »
Mediatemple is really F'ing up my christmas, so if you're getting errors and stuff that's why, sorry about that!

releases / v1.3 Planning Thread
« on: Tue, Jul 14, 2009 »

1 - fix FlxButton
2 - fix FlxText
3 - other minor fixes from my internal 1.25+ codebase [DONE]
4 - expose tinting in FlxSprite [DONE]
5 - standardize initialization (current constructors for FlxEmitter, for example, are very clumsy)
6 - create a repo on GitHub [DONE]
7 - add some sprite variables to help with top-down games
8 - doublecheck the support visor (paypal, stumbleupon, etc)
9 - make FlxKong a special case of a generic metrics system
10 - figure out basic parenting issues (e.g. scrollfactor on emitters, or x and y positions on layers)
11 - either remove fullscreen support or make sure it works with AIR [REMOVED]
12 - return some kind of Sound object from
13 - completely rebuild the way mouse and keyboard work [DONE]
14 - add in Nitram's debug flag thing
15 - callbacks or checks for overlapping specific tile indices or coordinates
16 - accessors for altering tilemaps on the fly
17 - bind 'p' and 'pause' to the pause behavior [OBSOLETE?]
18 - likely a lot of private member vars that should be protected instead [IN PROGRESS]
19 - pass a reference to hitFloor, hitCeiling and hitWall [DONE]
20 - improve sitelocking stuff (debug flag should help with this)
21 - include a basic cursor graphic [DONE]
22 - try converting main collision routine to using hulls [DONE]
23 - default stage menu should not be turned off, that is dumb and annoying
24 - facing/specific-random frame problems
25 - function to draw one sprite onto another [DONE]
26 - static flag for better collisions [DONE]
27 - lightweight seeded pseudo-random number generator - FlxG.random() [DONE]

Sorry for the delays!

Once I have this fixed, nicer version of flixel up on github some things I'd like to add ASAP (And that the community can probably help with!) include:

1 - session/cookie support
2 - ability to generate simple FlxSprite bitmaps procedurally (lines, triangles, circles, squares)
3 - more debugging tools (sliders, better console)
4 - pathfinding utility
5 - some kind of line of sight or ray utility

NOTE: some sites that would be good to include in the generic metrics system would be mochi, kong, newgrounds, netlog, ummm maybe others?


So I've been thinking some more about the next game I wanna make, and started narrowing down some of the tech that I'll need:

1 - Console Input
2 - Streaming Music
3 - Palette Swaps
4 - Mersenne Twister (seeded random numbers)
5 - Save Games via Sessions or Cookies or something
6 - Throttle framerate down to 5 or 10 or something while paused

EDIT - Rolled most of the other stuff that was listed here into the v1.25 patch!

chat / v1.21 is up (tilemap fix)
« on: Wed, Jul 8, 2009 »
There was a fairly serious bug in the tilemap drawing code, and I also added a function to let you specify a frame instead of having to bank on randomFrame when instantiating particles and stuff, BUT that function is NOT documented, just a heads up!

chat / v1.2 available for testing!
« on: Tue, Jul 7, 2009 »
v1.2 is up for testing!  Check it out, let me know what I F'd up!

> Fixed bug with facing & proc-gen box sprites
> Added FlxGame constructor param for skipping Flixel logo
> Removed the deletes in FlxArray's "remove" functions
> Simplified FlxArray "clear" function
> Added null checks to overlap and collide functions
> Fade and Flash need param Force == true to reset themselves
> Flash has a callback now
> FlxButtons use scrollFactor, visible, and flicker properly now
> General corrections to the way overlap works with scrollfactor
> Fixed pause music looping bug
> FlxG.scores and FlxG.levels are flxarrays now
> Doublechecked manual scroll manipulation
> Added new class FlxLayer
> FlxEmitter has optional parameter for parent FlxLayer
> FlxEmitter will not auto-add pre-existing sprites
> added new class FlxTilemap
> added callback to FlxSprite animation system
> fixed excessive frame calculation in FlxSprite animation
> added new optional PlayStateTiles to Mode example code

releases / possible music looping bug (v1.1)
« on: Fri, Jul 3, 2009 »
Sounds like there might be a problem with looping music and the pause state (I didn't change this MUCH for 1.1 from 1.0 but apparently it was enough to break it??)  I haven't personally verified this one yet

It looks like the global focus control thing starts to kind of have some problems if you have text input or other normal Flash widgets going on.  Not sure the best solution to this, but definitely need to do something!

Pages: 1 2 [3] 4 5