IDEA! Forums Programming PYGAME basics – lesson 1

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #373 Reply
    Chris
    Guest

    Introduction

    To learn programming a computer game in python you’ll need PyGame – a python module built on top of very popular graphics library for games SDL.

    To install it in Ubuntu type in console:
    sudo apt-get install python-pygame

    Example

    In this example I’ll explain how to create simple object controlled by keyboard and moving in a game window.

    Files needed:
    http://serwer.zygtech.pl/DoggyHearts/DoggyHearts.py – source code
    http://serwer.zygtech.pl/DoggyHearts/Doggy.png – player icon image

    To run example type in console:
    python DoggyHearts.py

    Example code consists of few functions:
    main() – creates PyGame window and loads the player image
    runGame() – creates player object and in main loop: clears window, displays player blit, reacts on keypress events and moves the object
    terminate() – terminates the game program

Viewing 1 post (of 1 total)
Reply To: PYGAME basics – lesson 1
Your information:




+ 66 = 73