本文整理汇总了Python中Windows.draw_windows方法的典型用法代码示例。如果您正苦于以下问题:Python Windows.draw_windows方法的具体用法?Python Windows.draw_windows怎么用?Python Windows.draw_windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.draw_windows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: import Windows [as 别名]
# 或者: from Windows import draw_windows [as 别名]
#.........这里部分代码省略.........
if event.type == KEYDOWN and event.key == K_UP:
self.up = True
#self.sendData('self.up = True')
self.data['coordinate'] = (0,0,1,0)
self.sendData(self.data)
if event.type == KEYUP and event.key == K_UP:
self.up = False
#self.sendData('self.up = False')
self.data['coordinate'] = self.stop_coord
self.sendData(self.data)
if event.type == KEYDOWN and event.key == K_DOWN:
self.down = True
self.data['coordinate'] = (0,0,0,1)
self.sendData(self.data)
#self.sendData('self.down = True')
if event.type == KEYUP and event.key == K_DOWN:
self.down = False
#self.sendData('self.down = False')
self.data['coordinate'] = self.stop_coord
self.sendData(self.data)
if event.type == KEYDOWN and event.key == K_SPACE:
self.space = True
#self.sendData('self.space = True')
self.data['shoot'] = True
self.sendData(self.data)
if event.type == KEYUP and event.key == K_SPACE:
self.shot_bull_game()
self.space = False
self.data['shoot'] = False
self.sendData(self.data)
if (event.type == QUIT) or (event.type == KEYDOWN and event.key == K_ESCAPE):
self.sendData("GOODBYE!!!!!!!")
reactor.stop()
sys.exit(0)
self.draw_game()
self.update_game()
#****************************отобрыжение процессов
def draw_game(self):
self.windows.draw_windows(self.screen)#рисуем окна
self.all_sprites_list.draw(self.screen)
self.block_list.draw(self.screen)
self.bullet_list.draw(self.screen)
pygame.display.update()# обновление и вывод всех изменений на экран
#****************************shot
def shot_bull_game(self):
self.player.shot_bull()
self.bullet_list.add(self.player.ret_bull())
#**************************** при столкновении пули с объектом удаление пули
def destroy_bull_game(self):
sprite.groupcollide(self.block_list,self.bullet_list,0,1)
#**************************** update
def update_game(self):
self.player.tank_update(self.left,self.right,self.up,self.down,self.space,self.platforms)
self.destroy_bull_game()
self.player.bull_move()
#****************************удаление данных (destroy data here)
def end_pygame():
pygame.quit()
#****************************ЗАПУСК ИГРЫ
def play_game(self):
print 'play_game'
self.init_window()
#self.end_pygame()
#****************************фунция запуска
def sendData(self, data):
self.cf.conn.send(data)
def getData(self, data):
print "INCOMING: ", data
self.parseData(data)
def parseData(self, data):
print type(data)
if isinstance(data, dict):
print "PARSING"
print data['id']
if data.get('type') == 'start':
print 'START THE GAME'
for k in data:
print "KEY: ",k," VALUE: ",data[k]