会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133620个问题

  1. 老师我有两个问题请教

  2. 图片上传功能能否使用其他技术实现,尝试过星愿浏览器,谷歌浏览器和火狐浏览器均不支持flash使用,如何解决。

  3. 每次服务启动之后,第一次登录提示登录失败,第二次开始均正常,且第一次登录后台报错,报错信息为

  4. 2021-08-10 09:01:10.373 ERROR 9656 --- [nio-8081-exec-4] w.a.UsernamePasswordAuthenticationFilter : An internal error occurred while trying to authenticate the user.
    
    org.springframework.security.authentication.InternalAuthenticationServiceException: Failed to invoke the method selectManagerByUsername in the service com.ego.dubbo.service.ManagerDubboService. Tried 3 times of the providers [192.168.57.1:20880] (1/1) from the registry 192.168.57.132:2181 on the consumer 192.168.255.1 using the dubbo version 2.7.6. Last error is: Invoke remote method timeout. method: selectManagerByUsername, provider: dubbo://192.168.57.1:20880/com.ego.dubbo.service.ManagerDubboService?anyhost=true&application=geo-manager&check=false&default=true&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&init=false&interface=com.ego.dubbo.service.ManagerDubboService&methods=selectManagerByUsername&pid=9656&qos.enable=false&register.ip=192.168.255.1&release=2.7.6&remote.application=ego_provider&side=consumer&sticky=false&timestamp=1628557228139, cause: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2021-08-10 09:01:09.349, end time: 2021-08-10 09:01:10.368, client elapsed: 1 ms, server elapsed: 1018 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=selectManagerByUsername, parameterTypes=[class java.lang.String], arguments=[admin], attachments={path=com.ego.dubbo.service.ManagerDubboService, remote.application=geo-manager, interface=com.ego.dubbo.service.ManagerDubboService, version=0.0.0}]], channel: /192.168.57.1:14222 -> /192.168.57.1:20880
    	at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:123) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:144) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:175) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:195) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:95) ~[spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212) ~[spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_202]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_202]
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.31.jar:9.0.31]
    	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_202]
    Caused by: org.apache.dubbo.rpc.RpcException: Failed to invoke the method selectManagerByUsername in the service com.ego.dubbo.service.ManagerDubboService. Tried 3 times of the providers [192.168.57.1:20880] (1/1) from the registry 192.168.57.132:2181 on the consumer 192.168.255.1 using the dubbo version 2.7.6. Last error is: Invoke remote method timeout. method: selectManagerByUsername, provider: dubbo://192.168.57.1:20880/com.ego.dubbo.service.ManagerDubboService?anyhost=true&application=geo-manager&check=false&default=true&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&init=false&interface=com.ego.dubbo.service.ManagerDubboService&methods=selectManagerByUsername&pid=9656&qos.enable=false&register.ip=192.168.255.1&release=2.7.6&remote.application=ego_provider&side=consumer&sticky=false&timestamp=1628557228139, cause: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2021-08-10 09:01:09.349, end time: 2021-08-10 09:01:10.368, client elapsed: 1 ms, server elapsed: 1018 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=selectManagerByUsername, parameterTypes=[class java.lang.String], arguments=[admin], attachments={path=com.ego.dubbo.service.ManagerDubboService, remote.application=geo-manager, interface=com.ego.dubbo.service.ManagerDubboService, version=0.0.0}]], channel: /192.168.57.1:14222 -> /192.168.57.1:20880
    	at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:113) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:259) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:82) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:74) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.common.bytecode.proxy1.selectManagerByUsername(proxy1.java) ~[dubbo-2.7.6.jar:2.7.6]
    	at com.ego.service.impl.LoginServiceImpl.loadUserByUsername(LoginServiceImpl.java:21) ~[classes/:na]
    	at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    	... 51 common frames omitted
    Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2021-08-10 09:01:09.349, end time: 2021-08-10 09:01:10.368, client elapsed: 1 ms, server elapsed: 1018 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=selectManagerByUsername, parameterTypes=[class java.lang.String], arguments=[admin], attachments={path=com.ego.dubbo.service.ManagerDubboService, remote.application=geo-manager, interface=com.ego.dubbo.service.ManagerDubboService, version=0.0.0}]], channel: /192.168.57.1:14222 -> /192.168.57.1:20880
    	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) ~[na:1.8.0_202]
    	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[na:1.8.0_202]
    	at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:181) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:61) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:55) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:81) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82) ~[dubbo-2.7.6.jar:2.7.6]
    	... 59 common frames omitted
    Caused by: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2021-08-10 09:01:09.349, end time: 2021-08-10 09:01:10.368, client elapsed: 1 ms, server elapsed: 1018 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=selectManagerByUsername, parameterTypes=[class java.lang.String], arguments=[admin], attachments={path=com.ego.dubbo.service.ManagerDubboService, remote.application=geo-manager, interface=com.ego.dubbo.service.ManagerDubboService, version=0.0.0}]], channel: /192.168.57.1:14222 -> /192.168.57.1:20880
    	at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:210) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:175) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.remoting.exchange.support.DefaultFuture$TimeoutCheckTask.notifyTimeout(DefaultFuture.java:298) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.remoting.exchange.support.DefaultFuture$TimeoutCheckTask.lambda$run$0(DefaultFuture.java:285) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:93) ~[dubbo-2.7.6.jar:2.7.6]
    	at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:179) ~[dubbo-2.7.6.jar:2.7.6]
    	... 69 common frames omitted

JAVA 全系列/第十八阶段:亿级高并发电商项目_架构/编码(旧)/电商:基于FastDFS+Nginx+Kinkeditor实现商品新增 18408楼
Python 全系列/第一阶段:Python入门/编程基本概念 18409楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/数据结构 18411楼

GIF.gif

老师好,一样的代码,为什么报错?                                                                  

Python 全系列/第二阶段:Python 深入与提高/文件处理 18414楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/容器(旧) 18416楼
Python 全系列/第十六阶段:Python 爬虫开发/爬虫基础(旧) 18417楼
Python 全系列/第一阶段:Python入门/函数和内存分析 18418楼

import pygame
import random
import time

screen_width = 700
screen_height = 500
bg_cloro = pygame.Color(0,0,255)
COLOR_RED = pygame.Color(255,0,0)

# 主类
class MainGame:
    window = None
    my_tank = None
    def __init__(self):
        pass
    # 开始游戏
    def startGame(self):
        # 初始化窗口
        pygame.display.init()
        # 创建一个窗口
        MainGame.window = pygame.display.set_mode([screen_width,screen_height])
        # 初始化我方坦克
        MainGame.my_tank = MyTank(340,240)
        # 建立一个标题
        pygame.display.set_caption('坦克大战')
        while True:
            # 给窗口添加颜色
            MainGame.window.fill(bg_cloro)
            # 调用方法
            self.getEvent()
            # 绘制文字
            MainGame.window.blit(self.getTextSuface('敌方坦克剩余数量%d'%5),(10,10))
            # 调用坦克显示的方法
            MainGame.my_tank.displayTank()
            # 更新窗口
            pygame.display.update()
            # 每循环依次休息0.02秒
            time.sleep(0.02)
    # 结束游戏
    def endGame(self):
        print("谢谢使用,欢迎再次使用")
        # 结束整个程序
        exit()

    def getTextSuface(self,text):
        # 初始化字体
        pygame.font.init()
        # 获取字体font对象
        font=pygame.font.SysFont("kaiti",18)
        # 绘制文字信息
        textSurface=font.render(text,True,COLOR_RED)
        return textSurface
    # 获取事件的方法
    def getEvent(self):
        # 将获取的所有事件放到eventList列表里面
        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_UP:
                    MainGame.my_tank.direction='U'
                    MainGame.my_tank.move()
                    print("上")
                elif event.key == pygame.K_DOWN:
                    MainGame.my_tank.direction = 'D'
                    MainGame.my_tank.move()
                    print("下")
                elif event.key == pygame.K_LEFT:
                    MainGame.my_tank.direction = 'L'
                    MainGame.my_tank.move()
                    print("左")
                elif event.key == pygame.K_RIGHT:
                    MainGame.my_tank.direction = 'R'
                    MainGame.my_tank.move()
                    print("右")

# 坦克类
class Tank:
    def __init__(self):
        pass
    # 移动方法
    def move(self):
        # 判断坦克方向的移动
        if self.direction=='U':
            self.rect.top-=self.speed
        elif self.direction=='D':
            self.rect.top+=self.speed
        elif self.direction=='L':
            self.rect.left-=self.speed
        elif self.direction=='R':
            self.rect.left+=self.speed
    # 发射子弹的方法
    def shot(self):
        pass
    # 显示坦克的方法
    def displayTank(self):
        # 获取展示的对象
        #self.image=self.images[self.direction]
        # 调用blit方法展示
        MainGame.window.blit(self.image,self.rect)

# 我方坦克类
class MyTank(Tank):
    def __init__(self,left,top):
        # 保存加载的图片
        self.images={
            'U':pygame.image.load('img/p1tankU.gif'),
            'D':pygame.image.load('img/p1tankD.gif'),
            'L':pygame.image.load('img/p1tankL.gif'),
            'R':pygame.image.load('img/p1tankR.gif'),
        }
        # 方向
        self.direction = 'L'
        #根据当前图片的方向获取图片 surface
        self.image=self.images[self.direction]
        #根据图片获取区域
        self.rect=self.image.get_rect()
        #设置区域的left 和top
        self.rect.left=left
        self.rect.top=top
        # 速度,决定移动的快慢
        self.speed=10

# 敌方坦克类
class Enemy(Tank):
    def __init__(self):
        pass

# 子弹类
class Bullet:
    def __init__(self):
        pass
    # 移动的方法
    def bulletMove(self):
        pass
    # 显示子弹的方法
    def displayBullet(self):
        pass

# 墙壁类
class Wall:
    def __init__(self):
        pass
    # 显示墙壁的方法
    def displayWall(self):
        pass

# 爆炸效果类
class Explode:
    def __init__(self):
        pass
    # 展示爆炸效果的方法
    def displayExplode(self):
        pass

# 音乐类
class Music:
    def __init__(self):
        pass
    # 播放音乐
    def playMusic(self):
        pass

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

我的坦克上下左右移动都没问题,但是不能切换方向(就是不换图片,方向一直朝左),不知道为什么

Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 18420楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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