Created
July 23, 2012 19:39
-
-
Save djcsdy/3165730 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flash.MovieClip; | |
class Bubble { | |
// Set this to true when the bubble is 'created'. | |
// Set it to false when the bubble is popped. | |
public var active:Bool; | |
var movieClip:MovieClip; | |
public function new(parentMovieClip:MovieClip) { | |
active = false; | |
var depth = parentMovieClip.getNextHighestDepth(); | |
movieClip = parentMovieClip.createEmptyMovieClip("Bubble" + depth, depth); | |
} | |
public function update() { | |
// Call this once per frame to update the Bubble (only if it is active). | |
} | |
public function render() { | |
// Call this once per frame to render the Bubble (only if it is active). | |
// Draw to movieClip here. | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import flash.MovieClip; | |
class Main { | |
static inline var MAX_BUBBLES = 512; | |
var bubbles:Array<Bubble>; | |
public function new(display:MovieClip) { | |
bubbles = []; | |
for (i in 0...MAX_BUBBLES) { | |
bubbles.push(Bubble.create(display)); | |
} | |
} | |
public function run() { | |
// Set up a game loop and gameplay logic here | |
} | |
static function main() { | |
new Main(flash.Lib._root).run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment