Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Two lines of code at the same time?
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?
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:
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Help to reduce time to execute the code prakash52kar 0 17 32 minutes ago
Last Post: prakash52kar
  Code scrape more than one time information Clnprof 5 129 Aug-26-2019, 09:26 AM
Last Post: Clnprof
  Need help - 22000 lines of code / alien writings! gfetng 1 267 Feb-22-2019, 03:25 PM
Last Post: ichabod801
  My code is taking longer time to give result rajeshwin 4 370 Feb-20-2019, 08:18 PM
Last Post: ichabod801
  Executing 2 lines at the same time SheeppOSU 2 462 Dec-22-2018, 05:16 AM
Last Post: Gribouillis
  2 lines causing code failure sfadil 5 669 Oct-26-2018, 09:58 AM
Last Post: sfadil
  Use a block of code only one time rlinux57 14 1,090 Sep-21-2018, 12:53 PM
Last Post: rlinux57
  How to generate more MP3 files at the same time in Amazon Polly using Python code? makiwara 2 1,005 Jul-02-2018, 08:43 PM
Last Post: makiwara
  OSError: [Errno 22] Invalid argument - wasn't there last time I ran the code! meganhollie 2 2,169 Jun-11-2018, 06:01 PM
Last Post: meganhollie
  Code issue with time remaining loop. Python3 deboerdn2000 11 3,256 May-04-2017, 04:53 PM
Last Post: deboerdn2000

Forum Jump:

Users browsing this thread: 1 Guest(s)