Hi, I’m trying to convert a very simple platform game from as1 to as2. When I change publish settings from flash 6/as1 to flash8/as2 the character falls through the level blocks which normally stop it from falling (in as1), here is the code in hero (the main guy - a movie clip):
onClipEvent(load){
//initialize variables
jump=false;
scream=false;
s=6;
this.gotoAndStop(1);
b = this.getBounds(this);
_root.timerID = setInterval(_root.goTime,10);
function move(x,y){
h=false;
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymin,true)){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymin,true)){
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymax,true)){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymax,true)){
_root.map._x -= x;
_root.map._y -= y;
h=true;
}
}
}
}
return h;
}
}
onClipEvent(enterFrame){
falling = move(0,s);
if(Key.isDown(Key.SPACE) && !falling && !jump){
jump = true; vel = -10;
_root.jumpSound.gotoAndPlay(2);}
if(Key.isDown(Key.LEFT)){
move(-s,0); this.play();
}
if(Key.isDown(Key.RIGHT)){
move(s,0); this.play();
}
if (jump) {
if(vel <= 10){
h = move(0,vel-s);
if(h == false && vel < 0){ vel *= -1;}
vel++;
}
else{
jump = false;
}
}
if (_root.map._y<-450 && !scream) {
scream=true; _root.fallSound.gotoAndPlay(2);
}
if (_root.map._y<-850) {
_root.map._x=0;_root.map._y=0;scream=false;
}
}
onClipEvent (keyUp) {
this.gotoAndStop(1);
}
that is pretty much all the code in the game, the rest is gotoAndStop etc
Can u spot anything there that would cause any probs in as2? My guess is something to do with getbounds or hittest…