Okay ...as you can see from the updated fla I tried to do a hit test with the walls on hero movie clip ... but it doesn't seem to work ...
code:
onClipEvent(load){
s = 10;
r = 5;
b = _root.map.getBounds(_root.map);
function move(x,y){
if(!_root.hero.hitTest(_x+x+b.xmin+1, _y+y+b.ymin+1, true)){
if(!_root.hero.hitTest(_x+x+b.xmax-1, _y+y+b.ymin+1, true)){
if(!_root.hero.hitTest(_x+x+b.xmin+1, _y+y+b.ymax-1, true)){
if(!_root.hero.hitTest(_x+x+b.xmax-1, _y+y+b.ymax-1, true)){
_x += x;
_y += y;
}
}
}
}
}
}
onClipEvent(enterFrame){
if(_root.scroll == "true")
{
if(Key.isDown(Key.UP)){
move(0,s);
}
if(Key.isDown(Key.UP) && Key.isDown(Key.CONTROL)){
move(0,r);
}
if(Key.isDown(Key.DOWN)){
move(0,-s);
}
if(Key.isDown(Key.DOWN) && Key.isDown(Key.CONTROL)){
move(0,-r);
}
if(Key.isDown(Key.LEFT)){
move(s,0);
}
if(Key.isDown(Key.LEFT) && Key.isDown(Key.CONTROL)){
move(r,0);
}
if(Key.isDown(Key.RIGHT)){
move(-s,0);
}
if(Key.isDown(Key.RIGHT) && Key.isDown(Key.CONTROL)){
move(-r,0);
}
}
}
I don't knwo what else to do ... hmm i'll keep trying..




Reply With Quote