项目需求,要做一张很大的地图,大过显示器。。。
在这张地图上面,滑动屏幕查看整张地图上所有的元素。
我的地图是放在画布下面
:主要的内容,主相机的大小就是我们屏幕的大小,所以我们做的只是移动相机的相对位置,让他在整张地图上面俯瞰。
编写场景脚本 map.js
/*
游戏主界面
*/
var HttpHelp = require("http");
var globaluserinfo = require("GlobaluserInfo")
// use this for initialization
onLoad: function () {
var self = this;
this.scale = 0.5;
this.isDistance = true;
var listener = {
event: cc.EventListener.TOUCH_ALL_AT_ONCE,
onTouchesBegan:function(touch,event)
{
self.onTouchStart(touch,event);
return true;
},
onTouchesMoved:function(touch,event)
{
self.onTouchMove(touch,event);
return true;
},
onTouchesEnded:function(touch, event){
self.onTouchEnd(touch,event)