Thursday, February 21, 2013
Generating Classes at Runtime
Generating classes at runtime, as3
http://www.as3commons.org/as3-commons-bytecode/emit.html
This looks a bit heavy for me, requires knowledge of opCodes to build classes.
Want to create a class with a .bitmapData accessor in it... Hmmm...
Tuesday, February 19, 2013
ThreeBlockTypes
[ UPDATE: 2013.07.28: SWF FILE REMOVED. Have decided to keep game off internet until it is finished and copyrighted. ]
Sunday, February 17, 2013
Bomb Type Design
Needs:
1. Invincible walls.
2. Explosions stop at invincible walls.
3. Icons for different bombs translate to how they explode.
4. Bomb modifier that can kill any type of block.
5. When holding keys while going through exit door, the next level loads right away.
Need to prevent this and give the user more time between level transitions.
Change between: pressed to justPressed
6. Bunnies set off the bombs and are a general pain in ass.
Bunnies can fall in ooze and turn into monsters.
1. Invincible walls.
2. Explosions stop at invincible walls.
3. Icons for different bombs translate to how they explode.
4. Bomb modifier that can kill any type of block.
5. When holding keys while going through exit door, the next level loads right away.
Need to prevent this and give the user more time between level transitions.
Change between: pressed to justPressed
6. Bunnies set off the bombs and are a general pain in ass.
Bunnies can fall in ooze and turn into monsters.
Friday, February 15, 2013
B0X Att@ck
Wednesday, February 13, 2013
Note Sketches
Sunday, February 10, 2013
POD Cloner iterates through non-dynamic properties just fine
package JM_LIB.utils { import mx.utils.ObjectUtil; /** * Clones any POD (plain old data) class: * @author JMIM */ public class PODClonerUtil { public function PODClonerUtil() { }; public static function clone(inObj:Object):* { //Step1: Get class of inObj, and instantiate a new object of that type. var c:Class = inObj.constructor; var newObj:Object = new c(); //POD clases take zero parameters. //Use Flex's ObjectUtil to extract properties of object. var classInfo:Object = ObjectUtil.getClassInfo( c ); var propArr:Array = classInfo.properties as Array; var prop:String; //must use this type of loop. Because the other will NOT work. for each (prop in propArr) { if (prop == "prototype") { continue;} newObj[ prop ] = inObj[ prop ]; } /* * //Does same thing as for each loop above. for (var i:int = 0; i < propArr.length; i++) { prop = propArr[i].localName; if (prop == "prototype") { continue;} newObj[ prop ] = inObj[ prop ]; } */ return newObj; } } }
Wednesday, February 6, 2013
Reference static class via variable
//Wanted to know if I could store a reference to a "registry"/"global container" inside of another class.
//This test proves it is possible.
//BUT, my auto-complete does not work on levelReg variable.
//NOTE: LevelReg (with capital "L") is the registry.
// levelReg (no capital "L" ) is the variable storing reference to the registry.
var levelReg:Class = LevelReg;
var levelNum:int = levelReg.currentLevelNumber;
trace("levelNum==" + levelNum);
levelReg.currentLevelNumber -= 4;
levelNum = levelReg.currentLevelNumber;
trace("levelNum==" + levelNum);
UPDATE:
"hasOwnProperty" works on reference as well:
if (levelReg.hasOwnProperty("currentLevelNumber") ) { trace("we have a currentLevelNumber prop"); }
if (!levelReg.hasOwnProperty("super peanutcats ") ) { trace("no super peanutcats");}
Output:
we have a currentLevelNumber prop
no super peanutcats
Friday, February 1, 2013
Make sure object property exists
Make sure object property exists, java.
Make sure object has a property.
This works for both Java and Actionscript. Used it before. But couldn't remember what it was called.
So Making a blog entry that is titled with the search terms I first thought of when looking for it in google.
That I way I can find it again.
//ANSWER:
someObject.hasOwnProperty("propertyNameAsString");
hasOwnProperty will return TRUE if the property exists, false if not.
Works for all objects in ActionScript and Java.
Subscribe to:
Posts (Atom)