0

I want to add a start screen where the game has not started and the screen just tells you to press [E] to go easy mode (speed random 17-20) and anything else for normal mode (speed random 20-25). Also, where would I insert the if statement for that? I know how to make everything, just don't know where to put it. Sorry if this is confusing.

This is my code so far without the if statement not including game loop, unneccesary defs and ending:

import pygame, random, time
pygame.init()
#define stuff
screen = pygame.display.set_mode([800, 600])
amount = 5

#generate cars
for i in range(amount):
    distance[i] = 0
    lap[i] = 1
    x[i] = 0

    speedx[i] = random.randint(20, 25)
    color[i] = (random.randint(0, 255),random.randint(0, 
255),random.randint(0, 255))
speedx[2] = 0
keepGoing = True
start_time = pygame.time.get_ticks()
furas
  • 134,197
  • 12
  • 106
  • 148
Jerry Xu
  • 13
  • 4
  • 1
    to create screen which gets pressed `E` in PyGame you have to create `mainloop` with `for event in pygame.event.get()` – furas Dec 17 '17 at 04:22
  • 1
    better find tutorial because you have to learn a lot to create screen with `[E]`: ie. [Program Arcade Games With Python And Pygame](http://programarcadegames.com/) – furas Dec 17 '17 at 04:24
  • see example [scenes-using-functions](https://github.com/furas/python-examples/blob/master/pygame/scenes-minimal-example-with-functions/main.py). It displays different `"scenes"/"screens"` and when you press any key it goes from one scene to another (with different background color). – furas Dec 17 '17 at 05:02
  • A direct link to my scenes example: https://stackoverflow.com/a/47460947/6220679 – skrx Dec 17 '17 at 08:15

0 Answers0