수정된 게임 (로더):


원본 게임:


액션스크립트 2.0 코드 (1 프레임) - 중요한 부분 & 전체 골격만:

COL_WHIT = 1;

COL_BLUE = 2;

COL_GREE = 3;

COL_YELL = 4;

COL_PURP = 5;

COL_RED = 6;

COL_ORAN = 7;

COL_BLAC = 8;

pballs = [

[] /* level 0 */, 

[COL_BLUE, COL_YELL, COL_GREE, COL_RED, COL_RED, COL_GREE, COL_YELL, COL_BLUE] /* level 1 */,

[COL_BLAC, COL_BLAC] /* level 2 */,

[COL_RED, COL_BLUE, COL_BLUE, COL_RED, COL_RED, COL_BLUE, COL_BLUE, COL_RED, COL_RED, COL_GREE, COL_GREE, COL_GREE, COL_GREE] /* level 3 */

];


loadMovieNum("puzzle-bobble.swf", 1);

var widthRate = _level1._width / Stage.width,

heightRate = _level1._height / Stage.height;

Stage.addListener({onResize: function() {

_level1._width = Stage.width * _root.widthRate;

_level1._height = Stage.height * _root.heightRate;

}});

_root.onEnterFrame = function() {

if(_level1 && _level1._root) {

_level1._root.watch("level1", function(prop, oldVal, newVal, userData) {

// hook getNextBall

_level1._root.getNextBall = function() {

...

};

// hook youReDead

var origYouReDead = _level1._root.youReDead;

_level1._root.youReDead = function() {

...

if(origYouReDead) origYouReDead();

};

return newVal;

});

// hook onEnterFrame

if(!_level1._root.guideline_mc) _level1._root.createEmptyMovieClip("guideline_mc", 600000);

_level1._root.onEnterFrame = function() {

if(_level1._root.cadre && _level1._root.cadre.onEnterFrame) {

_level1._root.render();

var c = _level1._root.cOords;

_level1._root.guideline_mc.clear();

_level1._root.guideline_mc.lineStyle(1, 0, 45);

_level1._root.guideline_mc.moveTo(c[0][0] + _level1._root.cadre._x, c[0][1] + _level1._root.cadre._y);

for(i = 1; i < c.length; i++) {

_level1._root.guideline_mc.lineTo(c[i][0] + _level1._root.cadre._x, c[i][1] + _level1._root.cadre._y);

}

}

};

delete _root.onEnterFrame;

}

};


핵심은 loadMovieNum() 함수로 다른 무비를 불러온 뒤

_levelX 를 이용해 접근해 제어하는 것.


보면 프레임 액션이 실행되기 전에 내 액션을 실행시키기 위해 Object.watch()를 이용해

프레임 액션에서 설정하는 변수를 watch한 것도 볼 수 있음. :)