Back to Home

Part 2 : Making a game in python || pygame

Feb 28, 2018 1 min read ... views
Python game tutorial
Advertisement

In this video, you will learn - Changing background of the game - Displaying image in the game - putting an image in a definite position Stay tuned -Stay subscribed for other parts of the tutorial.Meanwhile like, share and comment your queries. python code: # Import a library of functions called 'pygame' import pygame # Initialize the game engine pygame.init() display_width=800 display_height=600 black=(0,0,0) white=(255,255,255) red=(255,0,0) gamedisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption("Cool Game") clock=pygame.time.Clock() crashed=False carImg= pygame.image.load('car.png') def car(x,y): gamedisplay.blit(carImg,(x,y)) x=(display_width * 0.45) y=(display_height * 0.65) while not crashed: for event in pygame.event.get(): if event.type == pygame.QUIT: crashed= True gamedisplay.fill(red) #print(event) car(x,y) pygame.display.update() clock.tick(60) pygame.quit() quit() Keywords:
python game engine 2d, python game library, python game development, pygame game, python game creator, python game programming tutorial for beginners, pygame tutorial, python based games, Game development in python, build your own game in python with pygame, build your own game in python, make your own game in python, invent your own game in python, how to make a game in python for beginners, python game programming pdf, pygame tutorial for beginners, how to make a game in python without pygame, python games, pygame tutorial(pdf), making games with python and pygame,
Advertisement
P

Written by Puru

I am a software builder, developer, and technical writer. I design web products like JSON2Apex and the Python Visualizer. I write these guides to share actual, real-world development solutions and lifestyle strategies. No corporate fluff, just practical code and direct insights.

Need help? Ask our AI guide! 👋