This repository has been archived by the owner on Feb 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Shivneel's Algo
Shivneel Chand edited this page Dec 15, 2019
·
4 revisions
To start, I added the birds y_position and y_velocity to the screen using the Pygame library to display the text to the screen.The variables can be found in the mainGame function:
# player velocity, max velocity, downward accleration, accleration on flap
playerVelY = -9 # player's velocity along Y, default same as playerFlapped
playerMaxVelY = 10 # max vel along Y, max descend speed
playerMinVelY = -8 # min vel along Y, max ascend speed
playerAccY = 1 # players downward accleration
playerRot = 45 # player's rotation
playerVelRot = 3 # angular speed
playerRotThr = 20 # rotation threshold
playerFlapAcc = -9 # players speed on flapping
playerFlapped = False # True when player flaps
To display the variables to the screen, I used the Pygame library like so at the end of the mainGame funtion :
font = pygame.font.SysFont('',24)
text = "playery:" + str(playery) + " playerVelY: " + str(playerVelY)
text = font.render(text,True,(0,0,0))
textRect = text.get_rect()
textRect.center = (text.get_width()/2+3,SCREENHEIGHT-text.get_height()-10)
SCREEN.blit(text, textRect)
This code will display the playerVelY and playerY at the bottom of the screen. To change the location at which the variables are displayed, change the textRect.center parameters. To display more variables, alter the string named "text" by including more variables.