Skip to content

Flixel Cheat Sheet 2: Advanced Flixel Fu

AdamAtomic edited this page Sep 13, 2010 · 1 revision

These are basically collections of mini-tutorials, hopefully maybe a dozen at a time, that can be used either for learning or inspiration or reference. They deal with simple, focused questions about specific implementations. These are all works in progress but I’m hoping that we can keep these brief, direct and helpful, and maybe even hook them into the new online documentation? Or even link them into the source code master branch or something. We’ll see!

RUNNING OUT OF ENERGIES, I WILL UPDATE THESE LATEERRRR

Q – How do I do Mario-style hold-jumps?
> EASY PEEZY BRO

Q – What is the difference between FlxCore.collideArray() and FlxG.collideArray()?
> haha i don’t even know!!

Q – How do I do crazy special effects?
> Override preProcess() and/or postProcess()
> see FlxBlur and FlxBloom

Q – How do I do lighting?
> Create a black rectangle the size of the screen
> Set rectangle’s scrollFactor to (0,0) and blending mode to multiply
> Add this rectangle last (but before your HUD)
> Create light shapes by painting soft white shapes on black in photoshop
> set light shapes to screen and draw them to the black rectangle
using getScreenXY to figure out where they should go on the shape

Q – How does auto-tiling work?
> Check out the auto-tiling templates in org/flixel/data
> Auto-tiling uses a simple algorithm (link to class) to
assign tiles from those sheets based on surrounding tile data
> Your map data should use 0s for floors and 1s for walls
> Auto works good for platformers
> AutoAlt works good for top-down games
- Use 2 maps, inverses of each other, to create nice walls AND nice floors