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

QQ截图20201113170207.png

QQ截图20201113170224.png

小米官网.rar

图一是别人的样子,图二是我的样子。我把字体图标放大,文字就下去了,和图标没法对齐。。。

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 4246楼
JAVA 全系列/第七阶段:生产环境部署与协同开发/Docker 4247楼

求老师帮忙看下我的代码哪里出错了,效果一直出不来。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>canvas小球动画</title>
    <style>
        canvas{
            border:1px solid;
        }
    </style>
</head>
<body>
    <canvas width="400" height="300">你的浏览器不支持canvas标签</canvas>
    <script>
        var mycanvas=document.querySelector('canvas');
        var ctx=mycanvas.getContext('2d');
        var x=50;
        var y=50;
        var speed=-1;
        var speedY=2;
        //绘制一个小球
        var timer=setInterval(function(){
            ctx.clearRect(0,0,mycanvas.width,mycanvas.height);
            speed+=speed;
            if(x<=20){
                speed=Math.abs(speed);
            }else if(x>=380){
                speed=-speed;
            }
            speedY+=speedY;
            if(y>=280){
                speedY=-speedY;
            }else if(y<=20){
                speedY=-speedY;
            }
            ctx.beginPath();
            ctx.arc(x,y,20,0,2*Math.PI);
            // ctx.stroke();
            ctx.fillStyle='skyblue';
            ctx.fill();
            ctx.closePath();
        },60);
    </script>
</body>
</html>


WEB前端全系列/第九阶段:HTML5新特性模块/(旧)H5新特性 4248楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 4249楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/容器 4250楼
WEB前端全系列/第十一阶段:Nodejs编程模块--/Nodejs基础 4251楼

'''

load game window

'''


import pygame

# define constants

SCREEN_WIDTH=700

SCREEN_HEIGHT=500

BG_COLOR=pygame.Color(255,255,255)

#from curses import window

class MainGame():

    window=None

    # initialization method

    def __init__(self) -> None:

        pass

    # start game

    def startGame(self):

        #initialize the window

        pygame.display.init()

        #set the size of window

        MainGame.window=pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

        # set the title of window

        pygame.display.set_caption("tank war1.03")

        while True:

            # set the fill color for the window

            MainGame.window.fill(BG_COLOR)

            pygame.display.update


    # end game

    def endGame(self):

        pass


class Tank():

    def __init__(self) -> None:

        pass

    #defition of show tank

    def displayTank(self):

        pass


    #movement of tank

    def move(self):

        pass


    #shoot

    def shot(self):

        pass



#our tank

class MyTank(Tank):

    #initialization method

    def __init__(self) -> None:

        pass


#enemy tank

class EnemyTank(Tank):

    def __init__(self) -> None:

        pass


# class bullet

class Bullet():

    def __init__(self) -> None:

        pass


    #show bullet

    def displayBullet(self):

        pass


    #move

    def move(self):

        pass


# class wall

class Wall():

    def __init__(self) -> None:

        pass


    # the defition of show wall

    def displayWall(self):

        pass

# class explosion effect

class Explode():

    def __init__(self) -> None:

        pass


    #display the effect of explosion

    def displayExplode(self):

        pass



#class of sound effect

class Music():

    def __init__(self) -> None:

        pass


    #play music

    def playMusic(self):

        pass


# main method

if __name__ =='__main__':

    # call startGame() in the main class

    MainGame().startGame()



为什么我这窗口还是黑色的

image.png


Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 4252楼
JAVA 全系列/第一阶段:JAVA 快速入门/飞机大战小项目训练 4253楼
Python 全系列/第一阶段:Python入门/控制语句 4255楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO流技术 4258楼
JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 4259楼
JAVA 全系列/(隐藏)第二十三阶段:数字货币交易所项目/IASS基础服务的搭建和开发 4260楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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