The if statement is not registering variables changing
<p>The if statement is not realising that car1num and car2num changing and just ignoring them breaking the car switching and turning of the car.</p>

<p>ok in the code just below game_loop() it says "<strong>car2num = 2</strong>" and "<strong>car1num = 1</strong>" then later on it says</p>

<pre><code>    for event in pygame.event.get():
        if crashed == 0:
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RCTRL:
                    car2num += 1
                    if car2num == 4:
                        car2num = 1
                if event.key == pygame.K_LCTRL:
                    car1num += 1
                    if car1num == 4:
                        car1num = 1
</code></pre>

<p>so every time you press RCRTL car2num goes up and every time you press LCRTL car1num goes up and even later( there is one for both <strong>car1num</strong> and <strong>car2num</strong> )</p>

<pre><code>        if car2num == 1:
            car2IMG = pygame.image.load('textures\car1.png')
        if car2num == 2:
            car2IMG = pygame.image.load('textures\car2.png')
        if car2num == 3:
            car2IMG = pygame.image.load('textures\car3.png')
</code></pre>

<p>So then the number of car1/2num decides the car.</p>

<p>but it will always stay as the car it was originally set as "<strong>car2num = 2</strong>" and "<strong>car1num = 1</strong>".</p>

<p>Thank you for helping in advance and sorry for being disorganised.</p>

<h1>Full Code</h1>

<pre><code>import pygame
import os
from random import randint
from pygame.locals import *
import time
import random
gameDisplay = pygame.display.set_mode((800, 600), pygame.FULLSCREEN)
pygame.init()
infoObject = pygame.display.Info()
diswidth = 800
dishight = 600
cap = int(randint(0,4))

if cap == 1:
    caption = 'Light Drive - beat your friends'
elif cap == 2:
    caption = "Light Drive - don't crash"
elif cap == 3:
    caption = 'Light Drive - drive car drive!!!'
elif cap == 4:
    caption = 'Light Drive - BRUM BRUM'
else:
    caption = 'Light Drive - error'

car1IMG = pygame.image.load('textures\car1.png')
car2IMG = pygame.image.load('textures\car2.png')
car3IMG = pygame.image.load('textures\car3.png')
car4IMG = pygame.image.load('textures\car4.png')
car5IMG = pygame.image.load('textures\car5.png')
car0IMG = pygame.image.load('textures\car0.png')
onewinIMG = pygame.image.load('textures\Player-One.png')
twowinIMG = pygame.image.load('textures\Player-Two.png')
track = pygame.image.load('textures\TRACK.png')
def car1 (x1,y1):
    gameDisplay.blit(car1IMG,(x1,y1))
def car2 (x2,y2):
    gameDisplay.blit(car2IMG,(x2,y2))
def onewin ():
    gameDisplay.blit(onewinIMG,(((diswidth/2)-251),((dishight/2)-102.5)))
def twowin ():
    gameDisplay.blit(twowinIMG,(((diswidth/2)-267),((dishight/2)-102.5)))



def car3 (x3,y3):
    gameDisplay.blit(car3IMG,(x3,y3))

def car4 (xx4,yy4):
    gameDisplay.blit(car4IMG,(x4,y4))

def car5 (xx5,yy5):
    gameDisplay.blit(car5IMG,(x5,y5))



black = (0,0,0)
white = (255,255,255)
green = (0,255,0)
red = (255,0,0)
blue = (0,0,255)
yellow = (255,255,0)
orange = (255,112,0)
purple = (255,0,255)
cyan = (0,255,255)
grey = (112,112,112)

pygame.display.set_caption(caption)

clock = pygame.time.Clock()

def text(texts, color):
    font = pygame.font.Font('fonts\HWAndy.ttf',72)
    wintext = font.render(texts, True, color)
    gameDisplay.blit(wintext, (((diswidth/2)-200), (dishight/2)))
    gameDisplay.blit(wintext,)


def game_loop():
    rotation2 = 1
    rotation1 = 1
    car2num = 2
    car1num = 1
    fullscreen = False
    x1 = ((diswidth * 0.5)-32)
    x2 = ((diswidth * 0.5)-32)
    y1 = ((76))
    y2 = ((44))
    x2c = 0
    x1c = 0
    y2c = 0
    y1c = 0
    car0 = 0
    car3 = 0
    car4 = 0
    car5 = 0
    y3 = (dishight + 300)
    y4 = (dishight + 300)
    y5 = (dishight + 300)
    y0 = (dishight + 300)
    car1IMG = pygame.image.load('textures\car1.png')
    car2IMG = pygame.image.load('textures\car2.png')
    crashed = 0
    gameExit = False
    winner = 0
    while not gameExit:

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                gameExit = True
            if crashed == 0:
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_RCTRL:
                        **car2num += 1**
                    if event.key == pygame.K_LCTRL:
                        **car1num += 1**
                    if event.key == pygame.K_LEFT:
                        x2c = (0-(diswidth * 0.005))
                        rotation2 = 3
                    if event.key == pygame.K_RIGHT:
                        x2c = (diswidth * 0.005)
                        rotation2 = 1
                    if event.key == pygame.K_UP:
                        y2c = (0-(dishight * 0.005))
                        rotation2 = 0
                    if event.key == pygame.K_DOWN:
                        y2c = (dishight * 0.005)
                        rotation2 = 2
                    if event.key == pygame.K_a:
                        x1c = (0-(diswidth * 0.005))
                        rotation1 = 3
                    if event.key == pygame.K_d:
                        x1c = (diswidth * 0.005)
                        rotation1 = 1
                    if event.key == pygame.K_w:
                        y1c = (0-(dishight * 0.005))
                        rotation1 = 0
                    if event.key == pygame.K_s:
                        y1c = (dishight * 0.005)
                        rotation1 = 2
                    if event.key == pygame.K_ESCAPE:
                        gameExit = True
                if event.type == pygame.KEYUP:
                    if event.key == pygame.K_LEFT:
                        x2c = 0
                    if event.key == pygame.K_RIGHT:
                        x2c = 0
                    if event.key == pygame.K_UP:
                        y2c = 0
                    if event.key == pygame.K_DOWN:
                        y2c = 0
                    if event.key == pygame.K_a:
                        x1c = 0
                    if event.key == pygame.K_d:
                        x1c = 0
                    if event.key == pygame.K_w:
                        y1c = 0
                    if event.key == pygame.K_s:
                        y1c = 0
        car = random.randrange(0,100)
        if car == 0:
            car0 = 1
        if car == 1:
            car3 = 1
        if car == 2:
            car4 = 1
        if car == 3:
            car5 = 1

        if crashed == 0:
            x2 = x2 + x2c
            x1 = x1 + x1c
            y2 = y2 + y2c
            y1 = y1 + y1c
        gameDisplay.fill(grey)
        gameDisplay.blit(track,(0,0))

        if crashed &lt; 60 and crashed &gt; 0:
            crashed = (crashed + 1)
        **if rotation2 == 0:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3.png')
        if rotation2 == 1:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1 right.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2 right.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3 right.png')
        if rotation2 == 2:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1 back.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2 back.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3 back.png')
        if rotation2 == 3:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1 left.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2 left.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3 left.png')
        if rotation1 == 0:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3.png')
        if rotation1 == 1:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1 right.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2 right.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3 right.png')
        if rotation1 == 2:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1 back.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2 back.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3 back.png')
        if rotation1 == 3:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1 left.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2 left.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3 left.png')
        if x1 &gt; (diswidth - 194):
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1crashed.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2crashed.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 2
        if x1 &lt; 130:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1crashed.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2crashed.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 2
        if y1 &gt; (dishight - 94):
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1crashed.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2crashed.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 2
        if y1 &lt; 30:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1crashed.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2crashed.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 2
        if x2 &gt; (diswidth - 194):
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1crashed.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2crashed.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 1
        if x2 &lt; 130:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1crashed.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2crashed.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 1
        if y2 &gt; (dishight - 94):
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1crashed.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2crashed.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 1
        if y2 &lt; 30:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1crashed.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2crashed.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 1
        if x2 &gt; 185 and x2 &lt; 550 and y2 &gt; 85 and y2 &lt; 450:
            if car2num == 1:
                car2IMG = pygame.image.load('textures\car1crashed.png')
            if car2num == 2:
                car2IMG = pygame.image.load('textures\car2crashed.png')
            if car2num == 3:
                car2IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 1
        if x1 &gt; 195 and x1 &lt; 540 and y1 &gt; 95 and y1 &lt; 440:
            if car1num == 1:
                car1IMG = pygame.image.load('textures\car1crashed.png')
            if car1num == 2:
                car1IMG = pygame.image.load('textures\car2crashed.png')
            if car1num == 3:
                car1IMG = pygame.image.load('textures\car3crashed.png')
            if crashed == 0:
                crashed = 1
                winner = 2**


        car1(x1,y1)
        car2(x2,y2)
        if crashed == 60:
            crashed = 0
            gameDisplay.fill(black)
            if winner == 1:
                onewin()
                pygame.display.update()
                time.sleep(2)
            if winner == 2:
                twowin()
                pygame.display.update()
                time.sleep(2)
            winner = 0
            x1 = ((diswidth * 0.5)-32)
            x2 = ((diswidth * 0.5)-32)
            y1 = ((76))
            y2 = ((44))
            x2c = 0
            x1c = 0
            y2c = 0
            y1c = 0
            rotation2 = 1
            rotation1 = 1
            car1IMG = pygame.image.load('textures\car1.png')
            car2IMG = pygame.image.load('textures\car2.png')
        pygame.display.update()
        clock.tick(60)
game_loop()
pygame.quit()
quit()
</code></pre>