Pygameを使って透明色をImageFileを移動させる。
# -*- coding:sjis -*- import pygame from pygame.locals import * SCR_W = 200 #表示Windowの横幅 SCR_H = 100 #表示Windowの縦幅 def main(): pygame.init() #pygameの初期化 screen = pygame.display.set_mode((SCR_W, SCR_H)) #画面を作る pygame.display.set_caption('Hello pygame') #Title image = pygame.image.load('char.bmp') #絵を読み込む image = image.convert() #環境にあわせ最適化 imagerect = image.get_rect() #imageのrectを取得 clock = pygame.time.Clock() while 1: clock.tick(60) #keep the 60 fps screen.blit(image, imagerect) #絵を画面に貼り付ける pygame.display.flip() #画面を反映 imagerect.x += 1 #画像を移動 for event in pygame.event.get(): #イベントチェック if event.type == QUIT: #終了が押された? return if(event.type == KEYDOWN and event.key == K_ESCAPE): #ESCが押された? return if __name__ == '__main__': main()
おう!!!!!!!!どんだんけ簡単なんだ。DirectXでgameを作っていた事があるだけに、感じれるこれは簡単だ。
SDLがすげーんだろうな。
mimic28号でした。