PDA

View Full Version : Pong type game



havock
November 30th, 2004, 07:51 PM
Alright I got my game to work after a while and decided to add some UFO's in the background floating. I wanted them to just float down the screen so I used the snow tutorial and exchanged it with UFO's rather than...snow. Now my problem is, how do I make the UFO's in the background? They overlap whenever they fly over anything even though the movie clip is on the back layer. Anyone know what's going on?

Also, how do I make the game go to a certain ending depending on the score? I tried but could not figure it out, it's sort of hard to describe so I'll attach the .fla. I was thinking this had a key to my question;

//check left wall
if ((x-ballRadius < leftWall) and passedPaddle) {
Mouse.show();
computerScore++;
if (numBalls == 0) {
gotoAndPlay("game over");
} else {
numBalls--;
gotoAndPlay("start level");
}
}

but then If then it would be the last side the last ball hit rather than the score. Sorry if this is way to vague, but if you want you can check the .fla .

Edit; seems the file is to big (144), I think you can download it here though http://s7.yousendit.com/d.aspx?id=1FEF577CE8D7DC93BD48647F6553A0E5

havock
November 30th, 2004, 10:22 PM
Anyone know how to do the snow thing at least?

Also, I did the search and found I could do it behind certain movie clips, but I want to do it behind the whole thing in the background and not just behind the movie clip.

Thanks.

Dr Warm
November 30th, 2004, 11:18 PM
for the UFO's being on top of everything, that's because they're duplicated into a higher level than the other things
on the stage. if you go trace(computerPaddle) say, it'll come up with '_level0.computerPaddle' meaning it's in the
lowest level. To fix this you can use swapDepths (though i don't really like it) to move it to a higher level.
Or what i do is to load everything at the start (paddles ball etc, don't place it on the stage) so use attachMovie
for this, just place they're x values etc, where they are now.



but then If then it would be the last side the last ball hit rather than the score. Sorry if this is way to vague, but if you want you can check the .fla . That doesn't make any sense to me sorry, this code: //check left wall
if ((x-ballRadius < leftWall) and passedPaddle) {
Mouse.show();
computerScore++;
if (numBalls == 0) {
gotoAndPlay("game over");
} else {
numBalls--;
gotoAndPlay("start level");
}
}

works for me?!?

havock
December 1st, 2004, 01:21 AM
It works, I meant if I decided to use 2 endings. Game over if you lose and some other ending if you win. How would I make the winning/losing score go to that certain ending?

havock
December 1st, 2004, 08:21 PM
Okay, I got all that to work finally. But now I wonder how do I add sound to when the ball hits the paddle or a wall? Is it possible? I don't know how to add sounds through actionscripting at all.

Dr Warm
December 1st, 2004, 08:28 PM
Yeah it's possible, did it for a pong game for someone awhile ago....

yay found it! the thread is here (http://www.kirupaforum.com/forums/showthread.php?t=72577) (i made a fla for him)

basically you need a sound object:

_root.mySound = new Sound()
_root.mySound.attachSound("mySoundLinkageName")

if(ball._x < left edge or whatever you had!){
_root.mySound.Start()
}
does that help?