|
-
incredibulus-actionscriptum
splitting balls?
hi guys i gotta a question for you 
now immagine the game arkanoid
my ball hits the multiply the balls bonus
now i want 5 or more balls on the screen bouncing like crazy
what is the best way to do this?
i am stuck with the logic flow
heeeeelp
by the way mbenney love your new footer
-
Personally I'd use the Object.registerClass function to make a ball a component... thus all balls act the same way, but could have random vector values (speed, initial orientation). Then, when the ball hits whatever... use attachMovie to add more ball "components".
Sorry if that's a bit vague
Last edited by dotsyntaxJunkie; 08-07-2003 at 08:50 PM.
-
Senior Member
Re: splitting balls?
Originally posted by magnetos
hi guys i gotta a question for you 
now immagine the game arkanoid
my ball hits the multiply the balls bonus
now i want 5 or more balls on the screen bouncing like crazy
what is the best way to do this?
i am stuck with the logic flow
heeeeelp
by the way mbenney love your new footer
this is R rated forum
ms
sory I had to say this..I will think about your balls..
-
incredibulus-actionscriptum
Re: Re: splitting balls?
Originally posted by Mad-Sci
this is R rated forum
ms
sory I had to say this..I will think about your balls..
oh well you'll have to excuse my lousy english
its not my native language you know
and i think you meant G rated p- and p- again
and yes dotsyntaxJunkie you were quite vague
i have no idea what a Object.registerClass function might be
but it sounds cool
-
Senior Member
Why dont you duplicate your main ball MC 5 times..each ball however will have different speed but will follow the same rules..
ms
-
incredibulus-actionscriptum
Originally posted by Mad-Sci
Why dont you duplicate your main ball MC 5 times..each ball however will have different speed but will follow the same rules..
ms
well thats the easy part i am having problem checking when the balls are all out
i mean if the ball are all out then game is over
checking one ball its easy
if this ball_y is below the paddle_y game over
but how do i check if all the other balls are out?
maybe i should put a global counter on the ball or something
which everytime is duplicated increase by 1
so everytime the ball goes out _root.counter--
then if _root.counter==0 game is over
humm now that i am thinking of it
it could work
or not....
thank mad
-
DOT-INVADER
hey magnetos, long time no see ^^
well, your problem seems easy to solve. just apply what you just wrote, and that's it...
instead of having:
if this ball_y is below the paddle_y game over
have
if this ball_y is below the paddle_y counter--
if counter ==0 game over
of course, if you duplicated 5times the ball, also counter+=5
but that's what you just wrote... 
***EDIT***
don't forget to remove your ball right after it's below the player, or the counter -- will be calculated each frame
Last edited by marmotte; 08-07-2003 at 10:35 PM.
-
Object.registerClass is a really cool feature that attaches a movieclip to a constructor (ie object). In other words you could write just one object that contains all of the props (speed, initial orientation) and functions/callback (like onEnterFrame)...
then by using Object.registerClass, you could make sure that every instance of a movieclip conforms to the object you built. So every instance of a movieclip also has an instance of that code you wrote attached to it.
Heh, may seem kind of complicated but I'd recommend looking into it, since it's likely to save you a lot more time in the long run.
-
incredibulus-actionscriptum
thanks dotsyntaxJunkie i ll try to look for it but me and OOP dont like each other much maybe because i am too lazy to learn
hey thanks for the tips marmotte long time no see you too
i am still here... i am watching you guys this is my favorite forum you know 
ciao
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|