- 帖子
- 2
- 精华
- 0
- 积分
- 15
- 阅读权限
- 10
- 注册时间
- 2013-7-25
- 最后登录
- 2013-9-6
|
本帖最后由 OrangeScript 于 2013-8-28 14:57 编辑
- # -*- coding: utf-8 -*-
- import pygame
- from sys import exit
- pygame.init()
- SCREEN_SIZE=(450,800)
- screen = pygame.display.set_mode(SCREEN_SIZE,0,32)
- pygame.display.set_caption("plane")
- background=pygame.image.load('back.jpg').convert()
- plane=pygame.image.load('plane.png').convert_alpha()
- bullet=pygame.image.load('bullet.png').convert_alpha()
- x=0
- y=0
- while True:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- exit()
- x,y=pygame.mouse.get_pos()
- bullet_x,bullet_y=pygame.mouse.get_pos()
- x-=plane.get_width()/2
- y-=plane.get_height()/2
- screen.blit(background,(0,0))
- screen.blit(plane,(x,y))
- bullet_x-=bullet.get_width()/2;
- bullet_y-=bullet.get_height()/2;
- while bullet_y>=0:
- screen.blit(bullet,(bullet_x,bullet_y))
- bullet_y=bullet_y-100;
- pygame.display.update()
复制代码 这样写可以吗? |
|