PDA

View Full Version : [AS2] Game help


cokeman
12-06-2008, 11:56 PM
im trying to make a simple game where orbs fall and u have to catch them and get points, heres what i have for the orbs so far:

onClipEvent (load) {
var speed;
}
onClipEvent (enterFrame) {
_y = _y + speed
if(_y >= 200)
{
this.removeMovieClip()
}
}
onClipEvent (enterFrame)
{ if(_y >= 200)
{
duplicateMovieClip
} }
onClipEvent (load) {
function reset(){
this._y= -20;
this._x=random(400);
speed = random(5)+5;
}
reset();
}
onClipEvent (enterFrame) {
if (_root.bar.scrollStart){
this._x-=Speed+_root.mainGround.groundSpeed;
} else {
this._y+=Speed;
}
if (this._y>=400) {
reset();
}
if (this.hitTest( _root.bar ) ){
_root.gotoAndPlay ( "hit" );
}
}

Im trying to make it when it hits something called "bar" it plays 5 frames i made for the orb movieclip, but i cant get it to play the frames, and i named the first of those clips "hit", and even when i try to get it to gotoAndStop at a frame it wont work,also i try to get more than 1 orb on the thing at a time with this:

numcircle=3;
for (i=2; i<=numcircle; i++){
circle.duplicateMovieClip( "circle", i+100 );
}

but it only creates 2 extra orbs once and those 2 dissapear while they've fallen about half what thier supposed to fall and the other 1 falls all the way
then it preceeds to drop 1 at a time, please help

cokeman
12-07-2008, 03:03 AM
i figured out y the 2 orbs dissapeared early, silly mistake, but still havent solved the main problems

cokeman
12-07-2008, 07:58 AM
now also for my point system i made this:

onClipEvent (load) {
function updateScore(points)
{
score1 += points;
_root.score.text = score1;
}
_root.score.updateScore(1);
}
onClipEvent (enterFrame) {
if (_root.circle, hitTest(_root.bar)) {
_root.score.updateScore(1);
}}
score being the text box variable, and score1 being a variable...i hardley know what im doing anymore, HitTests are frustrating!!!