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 - Titch

Pages: [1]
releases / FlxTimer modification for easier callbacks
« on: Sun, Jul 10, 2011 »
Whilst porting my project from 2.x to 2.5 (an epic undertaking given that I had been working on if for a few months already) I made a little change to the FlxTimer code since the callback was really irritating me since it would cause crashes at runtime.

The change I made was in FlxTimer at line 87, which now looks like this.
Code: [Select]
if (_callback != null)
if (_callback.length == 1)_callback(this);
else _callback();


games / TIGJam Games 'Tearbringer' and 'Kitten Hunt'
« on: Fri, Jan 22, 2010 »
Arrow Keys - Move a kitten
Mouse - Click on a kitten

Only click the kitten you can control to send it to heaven, otherwise it goes to hell.

Theme: Kittens, Hunting, Games that are longer than an hour.
Jam Time: 60 Minutes
Team: Just me. I got the music from Waterflames NG Audio portal.
Prettyfying Time: 120 Minutes (added tiles, better kitten graphics, hud, death animations, title screen)
Source Code
Arrow Keys - Move and Jump

Jump on the little girls heads and make the world miserable. Chain hits together for greater effect.

Theme: Sunshine, Energy and Bubbles
Jam Time: 180 minutes
Team: Myself, Perrin (level design) and Terry (sound)
Prettyfying Time: 120 Minutes (added background effects, combo meter, main character animations and improved hud).
Source Code

Everything was written in Flixel 1.25. All the graphical/code resources are open source and free for anyone to use for any purpose.

help / Donations
« on: Sat, Dec 26, 2009 »
I want to make donation to the Flixel project in general. Is there a particular spot to do it or can I just use any old AdamAtomic PayPal Donate link?

help / Large numbers of FlxBlocks
« on: Tue, Dec 15, 2009 »
Curious about how many FlxBlocks people have put on screen before it started to cause significant slowdown. I'm thinking about doing a vertical moving tunnel digging game (you have to dig and built upward to escape) and was wondering if I could fill a couple of screens with them (like say 2 lots of 640x480 screens at 1:1 resolution and 16x16 tiles, so 2400 tiles) without significant slowdown. I would like to maximise the amount of space the player can work with, so some kind of value at which it becomes a big problem would be nice.

chat / Newgrounds Contest
« on: Wed, Dec 2, 2009 »

Newgrounds are running a Flixel Contest.

That is all.

help / FlashVars problem
« on: Fri, Nov 27, 2009 »
The medalsAPI for newgrounds doesn't work for me. I -seems- like it's because the API can't retrieve .parameters from the loaderInfo. I've tried pointing at stage both before and after loading as well as casting FlxG.state as a movieclip and using that.

Any idea why this might be? Is it because of the freaky factory pre-loader class? Is there a way around it?

help / FlashDevelop Tricks/Shortcuts.
« on: Mon, Nov 23, 2009 »
I've discovered quite a few handy shortcuts/tricks using FlashDevelop the cut time and effort when coding, since the documentation for it sucks, I thought I would share some of them here. Feel free to add any of your own, if you have any.

These hints are true of version 3.0.6 RTM, I can't speak for any past of future versions with certainty.

Write overrides faster
When typing out an override if you just type
Code: [Select]
override functionNameAnd then hit space, it generates the override function for you. So simply by typing
Code: [Select]
override update()You get
Code: [Select]
override public function update():void
This is especially useful for overriding functions that take a lot of parameters.

Faster import commands
If you find a file in the project menu and right click and select 'Add to Document' FlashDevelop generates the Embed tag for you. Be warned that this doesn't seem to work for XML files yet.

Abusing Global Classpaths
If you are tired of copying Flixel into every single folder, you can add it to your global classpaths and then access it from any project in FlashDevelop. I don't personally do this because I tend to modify the Flixel source on a per project basis, but if you are confident in your changes it would probably help streamline things a little.

Insert Colour
Very handy menu option listed in the Insert menu. Basically generated a hexadecimal code for any RGB colour in the format 0xRRGGBB, sure you have to put in the AA yourself, but it still can save some time for odd colours.

Useful Keyboard Shortcuts
Cntrl + Enter - Compiles and runs the project.
Cntrl + B - Insert Snippet. Code snippets can save a TON of pointless typing if you take the time to learn them.
F4 - go to declaration of element at cursor location.
Shift + F4 - Go back after jumping to an element

games / Gather Up [Prototype]
« on: Fri, Nov 20, 2009 »
Gather Up!
A game about materialism

The evil in the land has been defeated. The Infinite Ascension lies before you. All god demands is the memory of your life. That and you climb a massive tower filled with hoards of enemies that drop tons of junk. God is an odd guy like that.

Play the prototype
Last update 24th November

Use X to draw guns/shoot. Character automatically climbs up 1-2 block heights and jumps off ledges as you run off them. You can only use weapons when your feet are on the ground. Guns should target the nearest enemy to you. Use Up arrow or tap in the opposite direction to dodge


Just got Level Up to gold master stage, so I can pursue this full time now. Full game will be 5-6 months in development, a bit bigger than Level Up but more linear to allow for my crazy feature idea . Features a Hub world, epic long dungeon, five mini 'memory' dungeons/story events. Six weapons. Weapon modification system. More details to come.

Tutorials Signs - Covering the basics of attacking/dodging.
Improve gun loading - Add animations or HUD to make reloading clearer.
Enhance dodging - Add forward dodging. Refract control code so that it's more readable.
Inventory Handling/Loot Drops.

Intro Area - Start design for first game area as will be good for testing
First Boss - Sketch out boss code. Ect.
Weapon Switching

Combat Idle Anim - Doesn't face correctly.
Shooting though walls. Could be tricky, this one.

help / FlxTilemapSheet
« on: Tue, Nov 10, 2009 »
Like the FlxSpriteSheet class, this allows you to have tilemaps made with sheets of tiles rather than strips of them. I made it because the absurdly long strip of tiles in Level Up was a pain to work with.

I did -try- to make it an extension of FlxTilemap, re-writing _rects in the constructor, but I had too many problems with tileWidth messing everything up, so I just wrote a derivative class instead.

Code: [Select]
package com.titch.FlxExtensions
import com.adamatomic.flixel.FlxCore;
import com.adamatomic.flixel.FlxTilemap;
import flash.geom.Rectangle;
import com.adamatomic.flixel.FlxG;
import com.adamatomic.flixel.FlxSprite;
import flash.display.BitmapData;
import com.adamatomic.flixel.FlxArray;
import com.adamatomic.flixel.FlxBlock;
import flash.geom.Point;
* ...
* @author ...
public class FlxTilemapSheet extends FlxCore

private var widthInTiles:uint;
private var heightInTiles:uint;
private var _pixels:BitmapData;
private var _data:FlxArray;
private var _rects:FlxArray;
private var _tileSize:uint;
private var _p:Point;
private var _block:FlxBlock;
private var _ci:uint;

private var _screenRows:uint;
private var _screenCols:uint;

//@desc Constructor
//@param MapData A string of comma and line-return delineated indices indicating what order the tiles should go in
//@param TileGraphic All the tiles you want to use, arranged in a strip corresponding to the numbers in MapData
//@param Size The size of the tile (square) in pixels.
//@param CollisionIndex The index of the first tile that should be treated as a hard surface
//@param DrawIndex The index of the first tile that should actually be drawn
public function GathTilemap(MapData:String, TileGraphic:Class,Size:int = 16, CollisionIndex:uint=1, DrawIndex:uint=1)
_ci = CollisionIndex;
widthInTiles = 0;
heightInTiles = 0;
_data = new FlxArray();
var c:uint;
var cols:Array;
var s_rows:int;
var s_colunms:int;

var rows:Array = MapData.split("\n");
heightInTiles = rows.length;
for(var r:uint = 0; r < heightInTiles; r++)
cols = rows[r].split(",");
if(cols.length <= 1)
if(widthInTiles == 0)
widthInTiles = cols.length;
for(c = 0; c < widthInTiles; c++)

_pixels = FlxG.addBitmap(TileGraphic);
s_colunms = this._pixels.width / Size;
s_rows = this._pixels.height / Size;
_rects = new FlxArray();
_p = new Point();
_tileSize = Size;
width = widthInTiles*_tileSize;
height = heightInTiles*_tileSize;
var numTiles:uint = widthInTiles*heightInTiles;
for(var i:uint = 0; i < numTiles; i++)
if(_data[i] >= DrawIndex)
_rects.push(new Rectangle(_tileSize*((_data[i])%s_colunms),_tileSize*int((_data[i])/s_colunms),_tileSize,_tileSize));

_block = new FlxBlock(0,0,_tileSize,_tileSize,null);

_screenRows = Math.ceil(FlxG.height/_tileSize)+1;
if(_screenRows > heightInTiles)
_screenRows = heightInTiles;
_screenCols = Math.ceil(FlxG.width/_tileSize)+1;
if(_screenCols > widthInTiles)
_screenCols = widthInTiles;

//@desc Draws the tilemap
override public function render():void
//NOTE: While this will only draw the tiles that are actually on screen, it will ALWAYS draw one screen's worth of tiles
var tx:int = Math.floor(-_p.x/_tileSize);
var ty:int = Math.floor(-_p.y/_tileSize);
if(tx < 0) tx = 0;
if(tx > widthInTiles-_screenCols) tx = widthInTiles-_screenCols;
if(ty < 0) ty = 0;
if(ty > heightInTiles-_screenRows) ty = heightInTiles-_screenRows;
var ri:int = ty*widthInTiles+tx;
_p.x += tx*_tileSize;
_p.y += ty*_tileSize;
var opx:int = _p.x;
var c:uint;
var cri:uint;
for(var r:uint = 0; r < _screenRows; r++)
cri = ri;
for(c = 0; c < _screenCols; c++)
if(_rects[cri] != null)
_p.x += _tileSize;
ri += widthInTiles;
_p.x = opx;
_p.y += _tileSize;

//@desc Collides a FlxSprite against the tilemap
//@param Spr The FlxSprite you want to collide
override public function collide(Spr:FlxSprite):void
var ix:uint = Math.floor((Spr.x - x)/_tileSize);
var iy:uint = Math.floor((Spr.y - y)/_tileSize);
var iw:uint = Math.ceil(Spr.width/_tileSize)+1;
var ih:uint = Math.ceil(Spr.height/_tileSize)+1;
var c:uint;
for(var r:uint = 0; r < ih; r++)
if((r < 0) || (r >= heightInTiles)) continue;
for(c = 0; c < iw; c++)
if((c < 0) || (c >= widthInTiles)) continue;
if(_data[(iy+r)*widthInTiles+ix+c] >= _ci)
_block.x = x+(ix+c)*_tileSize;
_block.y = y+(iy+r)*_tileSize;


help / Multiplayer Online Framework
« on: Sat, Oct 17, 2009 »
I want to do some experiments with some simple online multiplayer stuff in Flixel (I saw something on tigsource about a simple multiplayer level/map designer). Can anyone give me some pointers as to where to start with this stuff. SharedObjects let you share data between clients, but is it better to get some other kind of server, rather than Flash Media server?

Also anything about the best way of storing persistant data online. Is MySQL the best way to go or should I have a cache on the sever to store the persistant world information?

Oh and also if anyone is interested in helping. That would be nice too. I'm not planning to build a whole big game, but perhaps polish off a small prototype or two to get an idea about scope and feasibility.

chat / Flixel IRC
« on: Sun, Oct 4, 2009 »
Would it be worth setting up a #Flixel IRC channel? I wouldn't mind having a place to hang out in during the day when I'm programming so I can bounce ideas off people or just get to know the community a bit better.

Since I went to all the effort of getting Mod files to work in Level Up! I though I would share the love. Obviously you'll need to get Flod in order for the FlxFlod wrapper to work. It works just like anything in FlxG would, only you write FlxFlod.setMusic() instead of FlxG. It doesn't yet have -all- the functionality of the Flixel music handling, but it does tie itself up with the built in volume controls, so altering music volume, master volume and mute all effect the mod output in real time.

Code: [Select]
package com.adamatomic.flixel
import com.neoart.flod.ModProcessor;
import flash.utils.ByteArray;

* ...
* @author Duncan Saunders 2009
* Distributed under the "I don't really care because I only spent a few hours on this"
* lisence.
public class FlxFlod extends FlxCore
private static var _modProcessor:ModProcessor;
private static var _soundTransform:SoundTransform;

public static function setMusic (mod:Class,looping:Boolean=true,autoplay:Boolean = true):void
FlxG.log("-----+ FlxFlod v0.3 +----");
if (_modProcessor == null)
FlxG.state.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
_soundTransform = new SoundTransform ();
_modProcessor = new ModProcessor ();
_modProcessor.load(new mod as ByteArray, true );
_modProcessor.loopSong = looping;

public static function play ():void

public static function pause ():void

public static function stop ():void
if (_modProcessor != null)
FlxG.state.stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);

private static function onKeyUp(event:KeyboardEvent):void
var code:String = String.fromCharCode(event.charCode);
if ((code == '0') || (code == ')') || (code == '-') || (code == '_') || (code == '+') || (code == '=')) {
    if ( != null) updateVolume();

private static function updateVolume ():void
_soundTransform.volume = FlxG.getMusicVolume() * FlxG.getMasterVolume() * int(!FlxG.getMute())
FlxG.log("volume set");
if ( != null) _modProcessor.soundChannel.soundTransform = _soundTransform;


It's a bit hacky, but best to share these things than keep them to yourself, eh?

chat / Flixel Contest?
« on: Thu, Sep 24, 2009 »
I've been thinking, wouldn't it be neat to have some kind of games making contest to promote Flixel? Like the best game made in five days using flixel or something. In fact it would probably be ideal for a 24 hour contest because the Framework accelerates everything so much.

help / Font Editing
« on: Tue, Sep 15, 2009 »
I've tried to do this already but I can't seem to find the right tools. Does anyone know how to edit font files so it would be possible to add some Glyphs to the default flixel Nokia font that look like the Flixel Arrow and Z/X/C glyphs (the ones in help) for writing control hints more easily.

releases / V1.25 - Max source image size
« on: Wed, Aug 5, 2009 »
When I made my tilemap image more than 8192 pixels it just quit drawing to the screen. I have a feeling it's a limitation of flash. It would be nice that if it is there is some kind of code in the flixel core that throws an a error to warn you why your tilemap isn't being drawn.

I'm pretty sure I read somewhere that the 8000 pixel thing is a flash limitation with bitmapData objects. It's worth the fair warning though, to anyone else doing projects with big tilesets, either set up with code that allows you to use full sheets instead of strips (you can go up to something around 2100x8192 like that) or split tilemaps between layers so you don't need a map containing ALL the data.

games / Level Up![FINISHED]
« on: Mon, Jul 27, 2009 »

Every day a girl runs out to collect magical gems, she learns from her actions and grows stronger with every step. Every night she has a reoccurring nightmare and forgets everything. There is only one way to break the cycle.

Watch the trailer
Play it on Newgrounds after the 25th of Novemeber :)
Last Update October 24th

Leveling up has a really simple structure. There are five kinds of experiance, for RUN,JUMP,COLLECT,DAMAGE and HEAL. Each time you perform the action associated with that type you gain exp, when you get enough that catagory levels up and your abilities improve a little. When you max a certain level, you gain an additional special skill.

Very nearly finished now (you can tell by the way of all the sponsor placeholders being in). I've got to work on the SUPER SECRET ENDING.

help / Drawing Tilemaps for Flixel using Mappy.
« on: Mon, Jul 27, 2009 »
Writing a level editor is a pain. Why do that when you could just use a tileset editor like Tilestudio or Mappy to lay out the level. Since Flixel uses a really standard text array input for tilesets, it's absolutely ideal for using a tile based mapping program to edit with. This is the meathod I've been using to work on my Flixel based game Level Up

To lay it out, this method uses FlxTilemap and you need to download a copy of Mappy and this script file + examples that plugs in to Mappy to output the map in a format that Flixel can understand.

First you need to prepare you tileset, if you haven't already. As far as I know all tiles in Flixel have to be square and laid out in strips. It's important to note that non-colliding tiles go at the START of a tilestrip. If you have to change the arrangement of tiles in the strip at a later point it will play absolute HAVOC with your map. Unless you are 100% CERTAIN, leave some space for later.

Here is an example set if you don't want to make your own just to try this out. Based on my previous advice this is crappy layout for the tiles, but I was trying to minimize the size of the file.

So the first job is to set up the script for use in Mappy. Once you've downloaded Mappy itself you need to extract the script file to the /luascr/ folder inside the directory with the mapwin.exe. You also need to edit MapWin.ini and add the extra script into the custom script menu, by scrolling down to where it says:
Code: [Select]
;    lua scripts
;    these are files in the luascr folder, they are textfiles that allow
;    custom functions to be written (see for language details)
;    to add them list them here preceded by lua01 to lua16, they appear
;    in the Custom menu. You can also drag and drop .lua scripts onto the editor
And add this at the bottom of the list
Code: [Select]
lua16=Export Flixel Tilemap.lua(In my setup, I replaced the flash script with the Flixel one to put it at the top of the menu)

Now open up Mappy. Open the File menu, select that you want to make a New map. You have to input the dimensions of the tiles and the number of tiles in the map. If you are just testing the functionality you will probably want to downsize the map from 100x100 to something smaller. If you are using the example chipset, set your tile size to 16x16. Then hit File and then Import. Select the file you want to import and they should pop up in the right hand column.

Now draw your Map. Mappy has a ton of different functions that I don't really want to go into right now. This method doesn't support animated tiles. If you want to do layers they have to be exported seperately and then arranged to be added in order in the code. In the future I'm going to update the export script to better handle multiple layers (or someone else can to).

Once you map is drawn out. Go to the Custom menu and select Export Flixel Tilemap. It will ask you to provide a filename and set an amount to shift the tiles by (It's best to leave this at -1 unless you know what you are doing). You should then get a big long comma delimited textfile full of numbers that you can import using FlxTilemap.

Setting up the map in game is a simple as  

[Embed(source = "data/example_map.txt", mimeType = "application/octet-stream")] public static var data_map:Class;
[Embed(source = "data/example_chip.png", mimeType = "application/octet-stream")] public static var data_tiles:Class;

var myMap:FlxTilemap;
myMap= new FlxTilemap(new data_map, new data_tiles, 3, 1);

Obviously you substitute example_map.txt for your own generated txt file from Mappy and example_chip.png for your own chipset when working on your own map. It's worth note that you can import multiple maps this way and layer them infront/behind the character. The main collision map is a good place to put other deco objects that appear in front of the player. I usually set up another map that is added before the player sprite as a background area.


I will update the Mappy export script to handle better layers nicely.
I will add some kind of compilable flash code to demonstrate this.
There are still some bugs with tiles not appearing correctly in Flixel. I will also adress these in the near future.
For some reason I still can't get Mappy to see transparncy on my tilesets. If anyone else has any luck with this please let me know.

Oh, and I'm sorry for being needlessly verbose >_>. This turned out to be really handy for me, so I hope it can help others.

Pages: [1]