I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Basic drawing

Syntax

This page will show you how to basic drawing in pygame. There is a lot of initial code you need to get used to before really embarking on pygame, the most important of which is the game loop.

Syntax

screen
=
display.
set_mode
((640,480))
draw.
rect(
screen,
(255,0,0),
(10,
10,
100,
100),
4)

Drawing in pygame revolves around the idea of a surface. A surface is a block of memory which can be updated by the draw commands and then, when drawing is complete, be sent to the graphics card. When doing any command using the draw object, you must always pass through a surface.

Rectangles form a large part of pygame and it is worth learning more about them. Also, it is also important to learn about surfaces as they provide a lot of the depth that pygame provides.

Helpful links

http://pygametutorials.wikidot.com/book-surf – Introduction to surfaces

http://www.pygame.org/docs/tut/newbieguide.html  Newbie guide to pygame

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Information