アニメ「バジリスク ~桜花忍法帖~ 」第一弾PV
アニメ『バジリスク ~桜花忍法帖~ 』
甲賀忍法帖の10年後の設定らしいですが、この作品中に甲賀忍法帖の話が出てきて、面白そうなので、並行して見ていこうかと思います。
アニメ見ていろいろ検索していて初めて知ったのですが、バジリスクといえば、スロットが有名らしいです。ということでスロット作ります。
今回は、pygame使います。
以前「ベイビーバンバンコマンド」で読んだソースがpygame使ってたので、参考にしてみます。
インストールはコマンド一発。
takk@deb9:~$ sudo apt-get install python-pygame
使う絵は手書き。腕によりをかけてベルを書きました。魂を込めたので一枚しか描けませんでした。
スクリプトです。こちらは絵と違って簡単です。
takk@deb9:~$ cat -n slot1.py
1 import pygame,sys,os
2 from pygame.locals import *
3
4 SLOTX,SLOTY = 1,3
5 PICTSIZE = 128
6
7 class Slot:
8 def __init__(self,pos):
9 self.mapdata = [[0],
10 [0],
11 [0],
12 [0],
13 [0],
14 [0],
15 [0]]
16
17 self.image0 = pygame.image.load("./bell.png")
18 self.rect = pygame.Rect(pos, self.image0.get_size() )
19 self.pos = pos
20
21 def draw(self,screen,s1):
22 y=0
23 x=0
24 for y in range(0,SLOTY+1):
25 x=0
26 yy = (y + (s1/PICTSIZE)) % 7
27 if self.mapdata[yy][x] == 0:thisimage = self.image0
28 screen.blit(thisimage, (x*PICTSIZE,((SLOTY-y-1)*PICTSIZE)+(s1%PICTSIZE)))
29
30 pygame.init()
31 screen = pygame.display.set_mode((PICTSIZE*SLOTX,PICTSIZE*SLOTY))
32 pygame.display.set_caption("SLOT")
33
34 map = Slot((0,0))
35
36 clk = pygame.time.Clock()
37 pos_y=0
38 p1=0
39 key_status = 0
40 while 1:
41 clk.tick(1000)
42 if key_status > 0: key_status-=1
43 key = pygame.key.get_pressed()
44
45 for e in pygame.event.get():
46 if e.type==QUIT:
47 sys.exit()
48 if e.type==KEYUP:
49 key_status=0
50 map.draw(screen,p1)
51
52 speed=16
53 pos_y+=speed
54 p1+=16
55
56 pygame.display.flip()
57
takk@deb9:~$
実行すると一列のスロットが動きます。


コメント