Wednesday, January 30, 2013
Saturday, January 26, 2013
GlitchMode
Tuesday, January 22, 2013
Ray lighting blocked out
Wednesday, January 16, 2013
Buffered Lighting System In
Light todo simple: A dark yellow tile will direct us to stamp a certain type of light at that coordinate. Light todo ADVANCED: Make it auto-project based on where it was set on the tile-map: 1. If tile directly below EXISTS: Project LIGHT THROUGH ALL TILES BELOW TILL YOU REACH FIRST EMPTY TILE 2. If tile NO TILE directly below: Project LIGHT till you hit a tile. Make light COVER that last tile that was hit. 3. If you have a HORIZONTAL row of CONNECTED light tiles, make all lights the SAME length. 4. If you have VERTICLE column of connected lights, DO step #3, but also make the lights project LEFT or RIGHT rather than DOWN. Deciding which way to project: Whichever side has the most empty space. Deciding how LONG the light is: Steps 1-3 still apply here. But on x-axis instead of y-axis.
Thursday, January 3, 2013
Binding Getters To Function Types
package { import flash.display.Sprite; import flash.events.Event; /** * ... * @author JMIM */ public class Main extends Sprite { public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point var hg:HasGetter = new HasGetter(); var func:Function = hg.getStuff; func(); } } } internal class HasGetter { public function get getStuff():Boolean { trace("hay!"); return true; } public function HasGetter() { }; }
Wednesday, January 2, 2013
Making Calculations
//TAKEN FROM STACK OVERFLOW:--------------------------------------------
Your problem is caused by the fact that Flash uses pre-multiplied alpha. Usually this is not a big issue, but it becomes very apparent if you have pixel values with very low alpha values which unfortunately are very common when you use a blurred soft-feathered brush. The pre-multiplication causes an information loss in the pixels - and when you have low alpha values the color values are effectively getting rounded down which when you are drawing slowly in your app and the same pixels are getting drawn over each other again and again will cause the area to get darker and darker. For some more details on the pre-multiplication issue check an old post of mine: http://www.quasimondo.com/archives/000665.php There is nothing you can do about this except if you handle the alpha channel and the rgb channel separately. But then you will also have to do all the compositing yourself which is not a trivial task and might slow down your app too much.
-------------------------------------------------------------------------Hmm... Even if it was fixable, saving out PNG files with the correct alpha channel would still have problems. Don't use alpha channel.
1234 5678 --Set bits describe which channel pixel exists on. [1111 1111]R [1111 1111]G [1111 1111]B Thus, each pixel becomes defined by 3 bits. There are 8 possible combinations for bits: BINARY RGB-EQUIVALENT:
000 [000,000,000] BLACK 001 [000,000,255] BLUE 010 [000,255,000] GREEN 011 [000,255,255] CYAN 100 [255,000,000] RED 101 [255,000,255] MAGENTA 110 [255,255,000] YELLOW 111 [255,255,255] WHITE
Basically: Compressing 3bit color tilemap into a 24bit PNG. 24/3 = 8. Making file size 1/8th of what it would be otherwise. Of course, this limits your selection of tiles. But with clever auto-tiling, we've got something good here. Special items like entrance/exits will be defined in a text file. Shouldn't use a whole channel for something that is only ever going to use up, say TWO pixels on the entire level PNG.I have 9 Levels
Game now has 9 levels loaded from PNG files. Also has win/lose conditions. It's somewhat of a game now. TODO: 1. Gun that deters but does not kill enemies. Gun can also set off mines INSTANTLY, from a distance. 2. Enemies that are bound by gravity, but cling to the walls, making them more mobile than you. 3. Make it so you can die if you get caught in the blast. 4. Score will simply be stats on how long it takes to complete each level. 5. Ladder Tiles that allow you to climb. They will be immune to explosions. 6. Think about vines too. Maybe Cables in your game. Like this game android: http://www.newgrounds.com/portal/view/428733