PDA

View Full Version : Pong Game Support Needed!!!


manthan98
01-15-2014, 09:34 AM
I made a pong game but i need help with incorporating a timer... anyone want to help... thx :(

MrMoke
01-15-2014, 02:36 PM
Putting the 3D Text2.Time() method in the While event is slowing everything. It needs to run in parallel with all other events.

Also, if you upgrade to 2.4.1, nothing will work:(

manthan98
01-16-2014, 08:39 AM
Yes i realized that as well... Do u have any idea on how i can incorporate the timer properly so that it runs smooth and doesnt crash... :confused:

chickentree
01-16-2014, 09:45 AM
Yes i realized that as well... Do u have any idea on how i can incorporate the timer properly so that it runs smooth and doesnt crash... :confused:

I did not have it crash, but did not do any kind of exhaustive testing either.

Two things to make it go faster:

Make another While the world is running event and put the 3D Text2.time method there. (Mr. Moke's Suggestion.)
Where possible, nest your if statements.


By nesting your if statements you only look at the next condition if the first one fails. So rather than:

if right then
do this
else
Do Nothing

if left then
do that
else
Do Nothing

You have:
if right then
do this
else
if left then
do that
else
Do Nothing

Note that you can use the pattern above to merge right and left or forward and back or ... but you cannot use it to combine right, left, forward, and back. Can you see why?

While this trick did seem to speed up the movie a good deal, I have no idea why it worked in this case. My confusion lies in the fact that, in this movie, most of the time the answer to the if statements will be false (we are not out of bounds) so all the conditions will be checked anyway and none of them will execute the "then" part.)

Situations like this in I typically group under the acronym MES (Magical Electrical Stuff.) To make it sound like I know what I am talking about:D

MrMoke
01-16-2014, 01:05 PM
Sorry for the delay-

Good info from the Chicken

I don't actually recommend the "While World is running" event, as the third part can seemingly never happen.
My preference is to add a "when World Starts" event for a CountDown method.

The CountDown Method:
1) While Loop doing nothing until a given Boolean variable changes from false to true.
2) It Then, Counts down to zero.
3) It Then, Sets the Boolean variable back false.
4) And is finished.

All other methods that need to can also use the Boolean variable for control.
Also note that all of the "when World Starts" events act as though they are all in a Big "Do together", and the single Boolean Variable gives you logical program control.:cool:

manthan98
01-17-2014, 09:08 AM
Thx for the help and support... Appreciate it :)

chickentree
01-17-2014, 12:01 PM
Sorry for the delay-

Good info from the Chicken

I don't actually recommend the "While World is running" event, as the third part can seemingly never happen.
My preference is to add a "when World Starts" event for a CountDown method.

The CountDown Method:
1) While Loop doing nothing until a given Boolean variable changes from false to true.
2) It Then, Counts down to zero.
3) It Then, Sets the Boolean variable back false.
4) And is finished.

All other methods that need to can also use the Boolean variable for control.
Also note that all of the "when World Starts" events act as though they are all in a Big "Do together", and the single Boolean Variable gives you logical program control.:cool:

Ah, FYI traditionally that's "tree" not "chicken" just to be pandantic and A-retentive:o
Why didn't I take the blue pill??
Mark

manthan98
01-19-2014, 05:05 PM
Mr Moke i tried implementing your suggestion but i still do not really get what you mean... could u plz try being a little more clear :confused: