Pixels simple t rex drawing

broken image
broken image
broken image

Self.yvelocity += -500*deltaTime #Gravity If(self.y = 0): #Only allow jumping if the dinosaur is on the ground to prevent mid air jumps.ĭef update(self, deltaTime): #Updates the y position of the dinosaur each second

broken image

(gameDisplay,white, )Īs an update, your code should now look like this.ĭef jump(self): #When adding classes into function, the first parameter must be the parameter To draw the ground, add this code to the main loop GROUND_HEIGHT = height-200#The y coordinate of the floor which is 200 pixels away from the bottom As we may want to experiment with the height of the ground we will use a variable to store it. The ground is essentially a rectangle which left corner is on the edge and the width of the rectangle is as wide as the window. Now that we know how to draw a shape, we would like to have the practical use of the shape in the game. #draws a rectangle at coordinate (30 ,30) with width 40 pixel, height 50 pixels and with colour white on the surface ’gameDisplay’ White = 255,255,255 #Define the RGB value of white as a tuple

broken image