PyGame。 はじめに
私はこの
ライブラリと話をする機会がありましたが、あなたと共有したいので、忘れないように自分自身のためにノッチを残してください:)この短い、私は良い例を使用して、最も理論的な基礎のいくつかを省略します
ドキュメントで説明されてい
ます )、ライブラリを操作する基本的な原理を示します。
チャレンジ。
矢印キーを使用してオブジェクトを移動できる「ゲーム」スペースを作成します。
理論
リストを投稿する前に、ライブラリモジュールで使用されているメソッドに焦点を当てます。ライブラリモジュールの説明はオフィスから取得されます。 ドキュメント。
画像モジュール
1.
pygame.image.load(ファイル名):Surfaceを返すご想像のとおり、この関数は特定の画像をロードし、表面の形で返します。これはすでにpygame関数でいくつかの操作(変換、移動、削除など)を実行できるタイプです。
表面モジュール
2.
Surface.blit(source、dest、area = None、special_flags = 0)指定されたサーフェス(ソース)をベース(サーフェス)の上に描画します。ここで、destはタプル(x、y)、レンダリングの座標、面積-(幅、高さ)はソースサーフェスのサイズです。 フラグを犠牲にして、正直に言うと、私はまだ理解していませんでした))
3.
Surface.get_rect()フォームのタプル(x、y、幅、高さ)を返します。ここで、x、yはそれぞれ表面(表面)の左上隅の座標、幅、高さはその次元です。
イベントモジュール
イベントやリクエストとやり取りすることができます。 つまり、pygameのイベント、たとえばキーストロークは、Eventオブジェクトで構成されるリストに配置されます。 これらすべての「イベントオブジェクト」は、Event.typeを介してアクセスできるタイプです。
4.
pygame.event.get()get()メソッドを使用すると、イベントのリストを取得できます。
長方形モジュール
長方形のタプルを操作するためのモジュール。
5.
Rect.move(X、Y)正の整数または負の整数を指定したX、Yだけ、元の座標に対して座標がオフセットされた新しい四角形を返します。
練習。
上記を考慮して、以下を取得します。
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
# -*- coding: cp1251 -*-
# pygame.
from pygame import *
import sys
# .
init ( )
# 640480
screen = display. set_mode ( ( 640 , 480 ) )
#
display. set_caption ( 'example' )
# , :
# jpg, png, gif( ), bmp, pcx, tga( ), tif.
background = image. load ( 'background.bmp' )
#
screen. blit ( background, ( 0 , 0 ) )
#
class GameObj:
def __init__ ( self , img, x, y, step ) :
self . img = img #
self . x = x # x, y -
self . y = y
self . step = step # ,
self . pos = img. get_rect ( ) . move ( x, y )
def _move ( self , event ) :
if event. key == K_UP: #273
self . pos = self . pos . move ( 0 , - self . step )
if event. key == K_DOWN:
self . pos = self . pos . move ( 0 , self . step )
if event. key == 276 :
self . pos = self . pos . move ( - self . step , 0 )
if event. key == 275 :
self . pos = self . pos . move ( self . step , 0 )
avatar = image. load ( 'player.bmp' )
#
x = GameObj ( avatar, 320 , 220 , 10 )
# ,
screen. blit ( x. img , x. pos )
# , :)
while 1 :
for i in event. get ( ) : #
if i. type == QUIT: #
sys . exit ( )
if i. type == KEYDOWN:
screen. blit ( background, x. pos , x. pos )
x._move ( i )
screen. blit ( x. img , x. pos )
# ,
display. flip ( )
あとがき。
実際、それはすべて、簡潔かつ怒ってです:)オフィスでレイアウトされた膨大な数のゲームを調べました。 サイト、そしてそこに本物の3Dクラフトを発見しました-同時に驚き、喜びました))ゲームのピークを征服するつもりはありませんが、私の好きな言語が多次元であることは素晴らしいことです。 誰かがこのトピックに興味があり、記録する意欲を失わないなら、確かに継続があります)。