会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132362个问题
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 38252楼
JAVA 全系列/第十二阶段:消息中间件(异步消息传递)/ActiveMQ 38253楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 38257楼

 MainGame.window.blit(self.Textsurface('敌方坦克剩余数量%d'%6) ,(10 ,10))

AttributeError: 'NoneType' object has no attribute 'blit'

老师我想显示左上角信息,报了这样一个错,琢磨不明白

# !/user/bin/env python3
# -*- coding: utf-8 -*-

import pygame
TEXTCOLOR=pygame.Color(255,0,0)
BG_COLOR=pygame.Color(255,0,0)
# 创建主类
class MainGame():
    window = None
    def __init__(self):
        pass
    # 开始方法
    def startGame(self):
        # 初始化窗口
        pygame.display.init()
        screen_width = 700
        screen_height = 400
        screen = pygame.display.set_mode([screen_width, screen_height])
        pygame.display.set_caption('坦克大战 1.0')
        while True:
            self.getEvent()
            MainGame.window.blit(self.Textsurface('敌方坦克剩余数量%d'%6),(10,10))
            pygame.display.update()

        # 结束方法
    def endGame(self):
        print('谢谢使用,欢迎下次使用!')
        exit()
    # 左上角文字的绘制
    def Textsurface(self, text):
        pygame.font.init()
        pygame.font.SysFont('kaiti', 18)
        # 绘制文字信息
        textSurface=font.render(text, True, BG_COLOR)
        return textSurface
    # 获取事件
    def getEvent(self):
        eventList = pygame.event.get()
        for event in eventList:
            # 监听事件类型
            if event.type == pygame.QUIT:
                self.endGame()
            # 判断事件类型是否是按下
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_d:
                    print('按下D键,坦克向右移动')
                elif event.key == pygame.K_a:
                    print('按下A键,坦克向左移动')
                elif event.key == pygame.K_w:
                    print('按下W键,坦克向上移动')
                elif event.key == pygame.K_s:
                    print('按下S键,坦克向下移动')
                elif event.key == pygame.K_SPACE:
                    print('坦克发射子弹')





if __name__ == '__main__':
    MainGame().startGame()


Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 38259楼
JAVA 全系列/第十八阶段:亿级高并发电商项目/亿级高并发电商项目(旧) 38261楼

parent.rar


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoServiceImpl': Injection of @Reference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.bjsxt.dubbo.service.DemoDubboService. No provider available for the service com.bjsxt.dubbo.service.DemoDubboService from the url zookeeper://192.168.59.128:2181/org.apache.dubbo.registry.RegistryService?application=myConsumer&dubbo=2.0.2&init=false&interface=com.bjsxt.dubbo.service.DemoDubboService&methods=showMsg&pid=13112&register.ip=192.168.59.1&release=2.7.6&revision=1.0-SNAPSHOT&side=consumer&sticky=false&timestamp=1623310222200 to the consumer 192.168.59.1 use dubbo version 2.7.6

image.png

image.png

JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/Dubbo 38262楼
JAVA 全系列/第三阶段:数据库编程/SQL 语言 38264楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637