hi,
anyone know how i would make this kinda game, i tried following a tut on flashkit but it was totally useless,
http://www.preload.it/singlePong/singlePong.htm
how would i create that?
thanks
hi,
anyone know how i would make this kinda game, i tried following a tut on flashkit but it was totally useless,
http://www.preload.it/singlePong/singlePong.htm
how would i create that?
thanks
The boundaries doesn’t have to be another movie clips at all (and checked with “hitTest”). Since your screen has a rectangular shape - it’s better to do this the “old way”:
If your boundaries are rectangular with parameters (0, 0, xMax, yMax), you can check if the ball touches eg. right boudary (xMax) and than change the ball direction with “_root.xmove *= -1;”.
You must add an “ofseet” into calculation (which is resulting from a width of the ball) - 1/2 of the width and 1/2 of the heigth (if your ball MovieClip is “centered”).
I think this works faster than “hit tests” and you don’t gotta have 3 additional MovieClips.
After this situation works out (the ball and the walls only) - delete the “IF clause” condition for the bottom edge and place a “paddle” there. Here you can do a “hitTest”.
The old way of “hit testing” was done this way:
For every object on the screen you calculate the edge coordinates (4 integers) and in every cycle of the game you have to check if some edges overlaps (simple substractions of integers which were fast even on the “old” computers.
What if you don’t do a 2-d, but a 3-d game?? (eg. isometric) Then a Flash hitTest isn’t of any use - you must do it this way (the “assembly way”). Check out my footer link for an isometric experiment.
I’ve found out that Flash has problems doing simple substractions (it slows down the whole thing!!). Today we have 700X faster computers than in the eighties, and we still have the same problems with Flash (optimizing and optimizing…).
After all [COLOR=red]Macromedia could have done it better![/COLOR]
:: Copyright KIRUPA 2024 //--