ArcaneMX
04-13-2005, 01:28 PM
Hi, simple question here;
My game includes a charecter with this script
onClipEvent(enterFrame){
speed *= .8;
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;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)) {
speed -= 1;
} else {if(Key.isDown(Key.DOWN)){
speed += 1;
} else {if(Key.isDown(Key.LEFT)){
_rotation -= 5;
} else {if(Key.isDown(Key.RIGHT)){
_rotation += 5;
}
}
}
}
}
(The character begins facing downward)
I need the background to;
1. Move as the character moves, and
2. DO NOT ROTATE. I cannot have a rotating background for gameplay
reasons.
To accomplish this, I need a script to either
1. Detect angle char is facing and move along that line,
or
2. Create a similar script that will move itself, and still be accurate, NOT
rotating.
Thnaks guys
My game includes a charecter with this script
onClipEvent(enterFrame){
speed *= .8;
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;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)) {
speed -= 1;
} else {if(Key.isDown(Key.DOWN)){
speed += 1;
} else {if(Key.isDown(Key.LEFT)){
_rotation -= 5;
} else {if(Key.isDown(Key.RIGHT)){
_rotation += 5;
}
}
}
}
}
(The character begins facing downward)
I need the background to;
1. Move as the character moves, and
2. DO NOT ROTATE. I cannot have a rotating background for gameplay
reasons.
To accomplish this, I need a script to either
1. Detect angle char is facing and move along that line,
or
2. Create a similar script that will move itself, and still be accurate, NOT
rotating.
Thnaks guys