问题描述
python开发飞机大战时出现以下错误:
Traceback (most recent call last):
File "D:/python/飞机大战.py", line 53, in
main()
File "D:/python/飞机大战.py", line 33, in main
bomb.draw(screen)
AttributeError: 'Bomb' object has no attribute 'draw'
在编程敌机爆炸的时候出现的
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
import pygame
import sys
from plane_sprites import *
bomb_flag = 0
import time
pygame.init()
pygame.mixer.init()
def main():
SCREEN = (1024,768)
screen = pygame.display.set_mode(SCREEN,0,32)
timg = pygame.image.load("./feiji/timg.png")
enemy_group = pygame.sprite.Group()
hero = Hero()
hero_group = pygame.sprite.Group(hero)
bomb = Bomb()
pygame.time.set_timer(CREAT_ENEMY_EVENT,1000)<