Looping/conditional code help? (Beginner)
Author |
Message |
Daxonie
|
Posted: Sun Mar 10, 2013 6:52 pm Post subject: Looping/conditional code help? (Beginner) |
|
|
What is it you are trying to achieve?
I am making a game of Pong for a class assignment. I would like to make Easy, Beginner, and Hard, in an option. I just want to speed up the delay to make it faster or slower.
What is the problem you are having?
Not sure how to change the delay speed based on the difficulty chosen without
making three separate loops.
Describe what you have tried to solve this problem
I worked until I figured out the three separate loops thing. However, my teacher says that if you have to repeat something
a bunch of times you're probably wrong. And so I need a much much more efficient way to accomplish this.
Sorry if the title was not correct, I'm just not familiar with any of this and so I probably sound pretty new.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using
I'm using version 4.1.1 of Turing |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dreadnought
|
Posted: Sun Mar 10, 2013 7:07 pm Post subject: Re: Looping/conditional code help? (Beginner) |
|
|
Well, I suppose the first question is how do you implement the delay? Is there any way to use a variable to control the delay? |
|
|
|
|
|
Raknarg
|
Posted: Mon Mar 11, 2013 9:03 pm Post subject: RE:Looping/conditional code help? (Beginner) |
|
|
Exactly. remember that the procedure delay (t) takes in an integer; therefore, anything that is an integer may go in that parameter |
|
|
|
|
|
Zren
|
Posted: Tue Mar 12, 2013 3:56 pm Post subject: RE:Looping/conditional code help? (Beginner) |
|
|
You probably want to make the movement speed of the enemy's paddle variable rather than slowing down the entire program. An increased delay between screen updates will make the animation less fluid. |
|
|
|
|
|
Raknarg
|
Posted: Tue Mar 12, 2013 4:10 pm Post subject: RE:Looping/conditional code help? (Beginner) |
|
|
that too. It's basically just making your program lag, remember. |
|
|
|
|
|
|
|