Skip to content

Instantly share code, notes, and snippets.

@with-heart
Created October 21, 2012 23:04
Show Gist options
  • Save with-heart/3928861 to your computer and use it in GitHub Desktop.
Save with-heart/3928861 to your computer and use it in GitHub Desktop.
def DrawFuelBars(surface):
# Draw player 1's fuel bar
x1 = 100 # FIXME: update to starting x location
y1 = 100 # FIXME: update to starting y location
x2 = x + player1_fuel
y2 = y + 10
color = (255, 255, 255) # TODO: add code to change the fuel bar's color based on fuel amount
pygame.draw.rect(surface, color, (x1, y1, x2, y2))
# Draw player 2's fuel bar
x1 = 400 # FIXME: update to starting x location
y1 = 400 # FIXME: update to starting y location
x2 = x - player2_fuel
y2 = y + 10
color = (255, 255, 255)
pygame.draw.rect(surface, color, (x1, y1, x2, y2))
def UpdateFuel(player, amount):
'''
Modify the given player's fuel by amount.
'''
if player == 1:
player1_fuel += amount
else:
player2_fuel += amount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment