Good day, everyone.
I’m having a little trouble with a game I am creating. I created a “falling snow” effect from this tutorial. I then added a movie clip character (which I’ll call the bunny) at the bottom of the screen that is stationary along the _y axis and can move left or right along the _x axis.
The point of the game I am trying to create is to have the bunny at the bottom of the screen collect the falling snowflakes, adding score to a counter. However, I am having trouble detecting when the flakes touch the bunny. I have tried using the hitTest in every way I could think of but nothing works. Here is my code:
this.createEmptyMovieClip("canvas_mc", 10);
Interval = setInterval(addDart, 1000);
function addDart () {
if(1 < 10) {
var t:MovieClip = canvas_mc.attachMovie("dart1", "dart"+i, canvas_mc.getNextHighestDepth())
i++;
t._x = Math.random()*Stage.width;
t._y = -50;
}
}
Bunny:
onClipEvent(enterFrame) {
if(Key.isDown(Key.LEFT)) {
this._x -= 15;
}
if(Key.isDown(Key.RIGHT)) {
this._x += 15;
}
}
I’m basically asking where and how I should be using the hitTest(). I know the basics of collision detecting but for some reason this code is proving to be real difficult.
Thanks to anyone who helps out!