PDA

View Full Version : error in on-collide


Elvan
06-23-2008, 04:43 PM
Greetings,

I was trying to learn how to make a platform game trough a tutorial.
In oder to learn it myself (and not just copy it) I make little basic scripts.

I was able to let my character move left and right. Thus so far no problem.
But when I wanted to use the script to activate an event when the character touches an object it didn't give the requested result.

Here is teh original code who does work.
onClipEvent (enterFrame) {
if (this.hitTest(_root.char)) {
// if this hits the char (_root.char)
_root.score.text++;
// _root.score goes up 1
unloadMovie(this);
// this movie clip is unloaded
}
}



Based on this code I came to this code who doesn't work
onClipEvent (enterFrame) {
if (this.hitTest(_root.billy)) {
// if this hits the char (_root.char)
gotoAndPlay("victory");
}
}


I kinda really can't see what I did wrong. I would apriciate the help. Sorry if i asked a stupid question >.>