Hey everone i would like to learn how to do Expert scrolling…
I did scrolling before but the simple way and annoying at that…
I want it so when it reahes the certain part of the X,y axis it will stop…
Im making an Birds-Eye-View car game…
SO maybe you can help…
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 1;
}
if (Key.isDown(Key.SPACE)) {
beep = new Sound;
beep.attachSound("horn");
beep.start(0,1);
}
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
if (Math.abs(speed)>25) {
speed *= .6;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if ((!_root.land.hitTest(_x+x, _y+y, true))) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
}
This is thw code im using and yes i know if i
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if ((!_root.land.hitTest(_x+x, _y+y, true))) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
}
Amd i change
x += x;
_y += y;
to _root.land then the code…
it will scroll howEver the hitTest doesent work great and it keeps going and going non stop…
Hope you can help…
Please reply as fast as posable ASAP