acor
August 27, 2004, 2:19am
1
I seem to be having a problem with the “hittest” function. My character will go straight through any object I put infront of it.
Heres the code for “characterf”:
onClipEvent (load) {
moveSpeed = 5;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
this._x += moveSpeed; _rotation = 0
} else if (Key.isDown (Key.UP)) {
*this._y -= moveSpeed; _rotation = 270 *
} else if (Key.isDown (Key.DOWN)) {
this._y += moveSpeed; _rotation = 90
} else if (Key.isDown (Key.LEFT)) {
this._x -= moveSpeed; _rotation = 180
}
}
Heres the code for “wall1”:
onClipEvent (load) {
if(_root.characterf.hitTest(this)){
characterf._x -= 5;
}
}
I would post the fla but i dont know how. And does anyone know how to invert a movie clip along the X axis on a key hit? I would prefer “characterf” to:
else if (Key.isDown (Key.LEFT)) {
this._x -= moveSpeed; _rotation = X_INVERT
*} *or something…
system
August 27, 2004, 3:11am
2
onClipEvent(enterFrame)//NEED THE ENTER FRAME
if (this.hitTest(_root.characterf)){
_root.characterf._x-=5;
}
}
and about the inverting…maybe you could try this._xscale
system
August 27, 2004, 3:36am
3
nevermind i got it to work but the movie clip now goes straight through the wall and then cant go back through it. Heres the revised code for “wall1”
onClipEvent (enterFrame) {
if (this.hitTest(_root.characterf)) {
_root.characterf._x = 1;
}
}
ive been playing with the x values but nothing seems to be working
system
August 27, 2004, 4:41am
4
nevermind I got it working. Although I would still like an answer to the invert movie clip question
system
August 27, 2004, 1:22pm
5
like i said, you could use the _xscale way. if you have an object and you want to invert it 100%, do something like this
onClipEvent(enterFrame){
this._xscale=-100;
}
if you want it to continue inverting itself maybe something like this
onClipEvent (enterFrame){
this._xscale+=3;
}