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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
    <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=FbonyatSbRvrD6W2ApVIpz5BGT9wE18a"></script>

    <title>Document</title>
    <style type="text/css">  
        html{height:100%}    
        body{height:100%;margin:0px;padding:0px}    
        #container{height:500px;width: 700px; border: 1px solid black;}    
    </style> 
</head>
<body>
    <div id="container"></div> 
    <button>加载</button>
    <script>
        var btn=document.querySelector('button');
        btn.onclick=function(){
            var map = new BMap.Map("container");    
var point = new BMap.Point(113.26512290418745, 23.154485582798717);    
map.centerAndZoom(point, 15);    
map.addControl(new BMap.NavigationControl());//平移缩放
//默认标注
// map.addEventListener('click',function(eve){
//     var tempMarker = new BMap.Marker(eve.point);        // 创建标注    
// map.addOverlay(tempMarker);  
// }


//------------------------自定义图标-------------------
var temPoint = new BMap.Point(113.26552290418745, 23.154485582798717);
var myIcon = new BMap.Icon("imgs/标注.gif", new BMap.Size(50, 50), {    
        // 指定定位位置。   
        // 当标注显示在地图上时,其所指向的地理位置距离图标左上    
        // 角各偏移10像素和25像素。您可以看到在本例中该位置即是   
        // 图标中央下端的尖角位置。    
        anchor: new BMap.Size(10, 25),    
        // 设置图片偏移。   
        // 当您需要从一幅较大的图片中截取某部分作为标注图标时,您   
        // 需要指定大图的偏移位置,此做法与css sprites技术类似。    
        imageOffset: new BMap.Size(-30, 10)   // 设置图片偏移    
    });      
    // 创建标注对象并添加到地图   
    var Mymarker = new BMap.Marker(temPoint, {icon: myIcon});    
    map.addOverlay(Mymarker);    
        }
    </script>
</body>
</html>

我的自定义图片怎么加载不了出来

WEB前端全系列/第九阶段:HTML5新特性模块/(旧)H5新特性 29717楼
Python 全系列/第十一阶段:重量级Web框架-Django/Redis的入门与应用(拓展) 29719楼
Python 全系列/下架-第十二阶段:Python_大型电商项目(5天后下架)/Django项目阶段-电商项目(旧) 29720楼
JAVA 全系列/第四阶段:网页编程和设计/Javascript 语言(旧) 29723楼

#主要包括坦克的创建,显示,移动及射击的功能

import pygame
COLOR_BLUE=pygame.Color(0,0,0)
COLOR_red=pygame.Color(255,0,0)
class MainGame():
    window=None
    def __init__(self):
        pass
    #开始游戏方法
    def startGame(self):
    #加载主窗口
       pygame.display.init()
#创建窗口
       MainGame.window=pygame.display.set_mode([700,600])
       pygame.display.set_caption("坦克大战")
       while True:
         MainGame.window.fill(COLOR_BLUE)
         self.eventlist()
         pygame.display.update()
         MainGame.window.blit(self.getTextSurface("剩余敌方坦克数量%d"%6)(5,5))
#结束游戏
    def endGame(self):
        print("谢谢使用,欢迎下次使用")
        exit()
    def eventlist(self):
        enentlist=pygame.event.get()
        for event in enentlist:
            if event.type==pygame.QUIT:
                self.endGame()
            if event.type==pygame.KEYDOWN:
                if event.key==pygame.K_UP:
                    print("按下上键,坦克向上移动")
                if event.key == pygame.K_DOWN:
                    print("按下下键,坦克向下移动")
                if event.key == pygame.K_LEFT:
                    print("按下左键,坦克向左移动")
                if event.key == pygame.K_RIGHT:
                    print("按下右键,坦克向右移动")
    def getTextSurface(self,text):
        pygame.font.init()
        font=pygame.font.SysFont("kaiti",18)
        testSurface=font.render(text,True,COLOR_red)
        return testSurface
MainGame().startGame()
class Tank():
    def __init__(self):
        pass
#坦克的移动方法
    def moveTank(self):
        pass
#碰撞墙壁的方法
    def hitwalls(self):
        pass
#展示坦克
    def displayTank(self):
        pass

38.png

老师看一下,我找不出哪个代码出现了问题


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

老师我启动后控制台有报错是什么原因呢。有影响吗

2020-05-15 14:04:56.716  INFO 5036 --- [           main] com.bjsxt.SpringBootDemo3Application     : Starting SpringBootDemo3Application on XTZ-20190629BHO with PID 5036 (C:\springBoot\springbootdemo3\target\classes started by Administrator in C:\springBoot\springbootdemo3)
2020-05-15 14:04:56.719  INFO 5036 --- [           main] com.bjsxt.SpringBootDemo3Application     : No active profile set, falling back to default profiles: default
2020-05-15 14:04:57.154 ERROR 5036 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.31] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
2020-05-15 14:04:57.223 ERROR 5036 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.31] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
2020-05-15 14:04:57.272  INFO 5036 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-05-15 14:04:57.277 ERROR 5036 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.31] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
2020-05-15 14:04:57.277  INFO 5036 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-05-15 14:04:57.278  INFO 5036 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.34]
2020-05-15 14:04:57.345  INFO 5036 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-05-15 14:04:57.345  INFO 5036 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 595 ms
2020-05-15 14:04:57.444  INFO 5036 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-15 14:04:57.544  INFO 5036 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-05-15 14:04:57.546  INFO 5036 --- [           main] com.bjsxt.SpringBootDemo3Application     : Started SpringB


JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 29726楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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