Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Looping/conditional code help? (Beginner)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Daxonie




PostPosted: 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)


Turing:






Please specify what version of Turing you are using
I'm using version 4.1.1 of Turing
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: