I heard that its better to put your code on the frame instead of movieclips. So far I’ve only seen one reason so far, its more organized than putting it on movieclips. Are there anyother reasons? If putting the code on the frames are better, then how can you make collision test? Also if putting code on frames are better how could I make this code work by putting it on the frame?
CODE:
onClipEvent (load) {
speed = 10;}
onClipEvent (keyUp) {
this.gotoAndStop("stand")}
onClipEvent (enterFrame){
if (Key.isDown(Key.UP)) {
this.gotoAndStop("walk_up");
this._y -= speed;}
else if (Key.isDown(Key.DOWN)) {
this.gotoAndStop("walk_down");
this._y += speed;}
else if (Key.isDown(Key.LEFT)) {
this.gotoAndStop("walk_left");
this._x -= speed;}
else if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop("walk_right");
this._x += speed;}
if (this._x + this._width/2 > 550) {
this._x = 550 - this._width/2
}
if (this._x - this._width/2 < 0) {
this._x = 0 + this._width/2
}
if (this._y - this._height/2 < 400) {
this._y = 400 + this._height/2
}
if (this._y + this._height/2 > 400) {
this._y = 400 - this._height/2
}
}
Thanks