Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Two lines of code at the same time?
#1
I'm making a small game I want the player to press A quickly. I print this and was thinking of a timer going up and when 'A' is pressed the timer will stop if it is fast enough then they'll pass.

Another idea was a timers set or a variable adds +1 and when at 10 they lose. But you can have simultaneous lines of code at a time?
Quote
#2
You don't need to have simultaneous code. When the button is pressed, you just record how long it took them. Then you have a conditional (if statement) to see if the time was short enough for a pass, and then in the body of the conditional you can execute however many lines of code you want.

if time_taken < maximum_time:
   do_something()
   do_another_thing()
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Help with two lines in a function amjass12 6 194 Jul-28-2019, 12:41 PM
Last Post: amjass12
  Display lines pgoosen 6 204 Jul-19-2019, 11:28 AM
Last Post: pgoosen
  Splitting lines ang grouping three at once samsonite 5 188 Jun-21-2019, 05:19 PM
Last Post: ichabod801
  How to re run lines in python? MrDoggo124 5 360 May-19-2019, 06:29 PM
Last Post: MrDoggo124
  Is there a way to automate changing the lines in a .txt like this? ejected 3 273 May-05-2019, 11:50 PM
Last Post: Skaperen
  print python json dump onto multiple lines lhailey 1 282 May-05-2019, 03:24 PM
Last Post: Yoriz
  Merge 2 lines with delimiter Buddhism 9 392 May-05-2019, 02:43 AM
Last Post: Buddhism
  Why does time.sleep(wait) add time in python3 ? gerardg 4 512 Apr-28-2019, 06:26 PM
Last Post: gerardg
  spliting similar but multiple lines anna 7 402 Apr-20-2019, 08:53 AM
Last Post: anna
  Need help - 22000 lines of code / alien writings! gfetng 1 231 Feb-22-2019, 03:25 PM
Last Post: ichabod801

Forum Jump:


Users browsing this thread: 1 Guest(s)