I know there are a few of these already but looking at some of them and trying them aren’t working out very well.
I simply want to apply a collision box on a movieclip i.e. a box, on each of the frames, or for pretty much anything that can be seen as a “physical object”. At the moment the character just walks across everthing, my team member created the character and implemented this code:
_root.attachMovie(“character”,“char”,_root.getNextHighestDepth());
char.xSpeed = 0;
char.ySpeed = 0;
char.onEnterFrame = function() {
if (Key.isDown(Key.UP)) {
trace(“UP”);
this.ySpeed = -2;
} else if (Key.isDown(Key.DOWN)) {
trace(“DOWN”);
this.ySpeed = 2;
} else {
this.ySpeed = 0;
}
if (Key.isDown(Key.LEFT)) {
trace(“LEFT”);
this.xSpeed = -3;
} else if (Key.isDown(Key.RIGHT)) {
trace(“RIGHT”);
this.xSpeed = 3;
} else {
this.xSpeed = 0;
}
if (this.xSpeed == 0 && this.ySpeed == 0) {
this.walk.gotoAndStop(“stand”);
}
if (this.xSpeed>0) {
char.gotoAndStop(“right”);
} else if (this.xSpeed<0) {
char.gotoAndStop(“left”);
} else if (this.ySpeed>0) {
char.gotoAndStop(“down”);
} else if (this.ySpeed<0) {
char.gotoAndStop(“up”);
}
this._x += this.xSpeed;
this._y += this.ySpeed;
}
Do i place the collision code on the character, if so where is the correct place, or do i place the code in the objects actions??