egret-labs / egret-game-library Goto Github PK
View Code? Open in Web Editor NEWEgret Game Library
Egret Game Library
lodash.js还是使用得比较多的,希望考虑一下。
io("http://localhost:4000",{query:{'authorization': a }});
我用socket.io官网下载的js,socket.handshake.query.authorization是有值的;
但是我用socket.io.ts,socket.handshake.query里没有authorization,但是socket.request._query里有authorization
throw new Error(b ? "Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip.json ... howto/read_zip.html" : "Corrupted zip : can't find end of central directory");
用白鹭内置的调试器可以运行成功。但是在使用浏览器的情况下就会报错。我咨询过白鹭的技术人员。那边给出来的是jszip库内部的问题。
刚使用上TileMap库,没有找到移动地图的API,
我按照例子已经初始化出来地图并显示了
var data: any = egret.XML.parse(e.currentTarget.response);
this._tileMap = new tiled.TMXTilemap(400, 600, data, this._url);
this._tileMap.render();
this.addChild(this._tileMap);
设定的渲染区域为400x600。我没有找到移动地图的方法,请问如果要移动地图该使用什么方法,在哪个类下呢?(移动x,y,会把渲染区域也跟着移动)
读了下Tiled.js,没有找到offset的方法,draw方法都是x0, y0开始画的
PS: 如果把render width & render height设成图片的大小,那么渲染区域都变很大了,需求只想在比如 200 x 200的区域渲染
tile.js 第2833行
if (this.images.length > 1) {
_spritesheet = spritesheets[tile.gid - this.firstgid];
var rect = new egret.Rectangle(0 * (this.tilewidth + this._spacing) + this._spacing, 0 * (this.tileheight + this._margin) + this._margin, this.tilewidth, this.tileheight);
}
else {
_spritesheet = spritesheets[0];
var rect = new egret.Rectangle((id % this.horizontalTileCount) * (this.tilewidth + this._spacing) + this._spacing, (Math.floor(id / this.horizontalTileCount)) * (this.tileheight + this._margin) + this._margin, this.tilewidth, this.tileheight);
}
可以看到你算rect的x位置时,代码用的是编号x间距+间距,y位置时则是编号x边距+边距
但实际上无论x还是y,都应该是编号x间距+边距(间距是两个图块直接的距离,边距是所有图块和纹理集边缘的距离),否则除非边距和间距相等,否则排版一定出现问题(结果是拼接出的地图到处都是黑线,无法互相贴合)
应该改成
if (this.images.length > 1) {
_spritesheet = spritesheets[tile.gid - this.firstgid];
var rect = new egret.Rectangle(0 * (this.tilewidth + this._spacing) + this._margin, 0 * (this.tileheight + this._spacing) + this._margin, this.tilewidth, this.tileheight);
}
else {
_spritesheet = spritesheets[0];
var rect = new egret.Rectangle((id % this.horizontalTileCount) * (this.tilewidth + this._spacing) + this._margin, (Math.floor(id / this.horizontalTileCount)) * (this.tileheight + this._spacing) + this._margin, this.tilewidth, this.tileheight);
}
When mouse.enable and slot.pixelHitTest set to true, strange things happen. Here is video link( watch at 0:50)
https://drive.google.com/file/d/0BwsVOnSgMnUIemU5UW1EeDY4ODg/view
However when i test this game in other browser it work good..
also mouse.setButtonMode() don't work for me , and as for me it would be more useful if this library would contain mouse.hide() and mouse.show() methods. Thanks for your attention!)
Uncaught TypeError: this.$invalidateContentBounds is not a function at (c:\Users******\Documents\EgretProjects\egretnoeui\libs\modules\particle\particle.js:267:18)
这里是报错信息,粒子库看了github是5.0.14 是需要版本配对使用吗,暂时没有找到最新粒子库
libs/modules/tiled/tiled.d.ts(18,18): error TS1005: 应为“=”。这个错误是怎么回事? typescript版本不对吗?
please update to latest version
现在GravityParticleSystem里面的属性全部是私有的,这样的话在程序里面就不能动态去改变这些参数,很难满足需求
Tiled 能显示对象层,但图像层的图片不显示
官方demo中加入如下代码
this.btn3 = new egret.TextField();
this.btn3.text = "停止";
this.addChild(this.btn3);
this.btn3.x = 180;
this.btn3.y = 100;
this.btn3.width = 100;
this.btn3.height = 50;
this.btn3.touchEnabled = true;
this.btn3.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
this.system.stop()
egret.log('need stop')
}, this);
在网页端可以正常运行,在Android项目中无法停止。
在5.1.x版本可正常运行。
在mapeditor中建立对象层。并添加N个图片。
运行时对象层中所有图片无法显示。
为什么tilemap的代码被去掉了,是准备重写吗
以下两句会将_opacity和visible的默认值设置错误, 分别为NaN, false
this._opacity = (typeof +data.attributes.opacity !== "undefined") ? +data.attributes.opacity : 1;
this.visible = (typeof +data.attributes.visible !== "undefined") ? Boolean(+data.attributes.visible) : true;
应改为和TMXLayer一样
this._opacity = (typeof data.attributes.opacity !== "undefined") ? parseFloat(data.attributes.opacity) : 1;
this.visible = (typeof data.attributes.visible !== "undefined") ? Boolean(+data.attributes.visible) : true;
从源码从 看到 TextField 的multiline属性只支持 TextFieldType.INPUT.
但是非 输入模式, 单步跟踪 也没有发现 处理 \n 换行符的处理.
而是使用了 textField 的 width 来强制断行.
不知道是我使用的不对, 还是引擎设计的时候 就是如此?
望大佬指教!谢谢
地图片段
<tileset firstgid="3" name="bigMap" tilewidth="188" tileheight="100" tilecount="30" columns="5" spacing="2">
<image source="bigMap.png" trans="f9fdff" width="948" height="610"/>
</tileset>
会报如下错误
tiled.js:2847 Uncaught Error: no matching tileset found for gid 29
请问打算添加underscore库吗?
GravityParticleSystem里的getValue函数用于取得base-var之间的随机值。
但是为什么是取正负var值? 是什么意图?
正确的应该是在base上叠加0至var之间的随机值吧?
否则如果lifespan = 1000, lifespanVar = 2000,那么粒子的生命最终值会是1000至-1000之间浮动。
小于0生命的粒子还有意义吗?生产了立即就被删除了。
这个是BUG还是你们本意就是这样?
Uncaught TypeError: Cannot set property 'texture' of undefined
/**
* 加载图片
* @param $url 图片地址
* @version Egret 3.0.3
*/
p.loadImage = function (url) {
if (url == null || url == "")
return;
RES.getResByUrl(url, function (texture) {
if (texture) {
// 此行报错
this._sourcebitmap.texture = texture;
this._texture = texture;
this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
}
}, this, RES.ResourceItem.TYPE_IMAGE);
};
已经是两年前的了,缺少navigateTo等方法
将所有 createElementNS 改为 createElement。不确定是否有风险
用egret3.1.6打包成APK以后是否还可以用?
不是100%监听不到按键抬起的事件,大部分按键抬起监听不到,只偶尔能监听到。
复现方法:
把官方demo中监听keydown改成keyup就可以复现。
在使用脏区域时,粒子不被渲染,因为要查脏区域的代码太复杂所以没有查具体问题所在,但是可以肯定的是只要开了脏区域,不管当前粒子发射位置在不在渲染区域内,都不会被显示。
请问有支持下拉刷新,上拉加载更多的列表控件吗
`kb.once(KeyBoard,onkeydown, (e)=>{}, this);
超过等待响应后不能取消监听
kb.removeEventListener(KeyBoard.onkeydown,(e)=>{},this)
无效用
`
egret wing版本.3.0.5
[log] VillageExample
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\index.html:130:17)
[log] Uncaught TypeError: Cannot set property 'texture' of undefined
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\tiled\tiled.js:800:48)
p.onResourceItemComp at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:3171:31)
p.onItemComplete at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:720:31)
p.onLoadFinish at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:1323:22)
p.$notifyListener at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:550:35)
p.dispatchEvent at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:529:25)
p.dispatchEventWith at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:588:35)
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.web.js:2056:26)
/**
* 加载图片
* @param $url 图片地址
* @Version Egret 3.0.3
*/
p.loadImage = function (url) {
if (url == null || url == "")
return;
RES.getResByUrl(url, function (texture) {
if (texture) {
this._sourcebitmap.texture = texture;
this._texture = texture;
this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
}
}, this, RES.ResourceItem.TYPE_IMAGE);
};
/**
* 加载图片
* @param $url 图片地址
* @Version Egret 3.0.3
*/
p.loadImage = function (url) {
if (url == null || url == "")
return;
RES.getResByUrl(url, function (texture) {
if (texture) {
this._sourcebitmap.texture = texture;
this._texture = texture;
this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
}
}, this, RES.ResourceItem.TYPE_IMAGE);
};
现象:引入了tiled库后,在安卓真机环境下,微信小游戏里执行报错;
报错内容:
定位是执行 render方法报错 tmxTileMap.render(),
catch打印的信息是fromIndex(2) > toIndex(1);
求帮助
TMXHexagonalRenderer 对象属性如下:
_hexsidelength:0
_rowheight:25
_sidelengthx:0
_sidelengthy:0
_sideoffsetx:47
_sideoffsety:25
_staggeraxis:"y"
_staggerindex:"odd"
animationTiles:Array[0]
cols:92
rows:45
tileheight:50
tilewidth:94
在调用TMXHexagonalRenderer.pixelToTileCoords()
方法返回的结果和实际tiled 地图中的坐标有偏差
问题描述:tiled.js中加载地图的方式(如下图)为地图tmx文件中所有地图瓦片资源加载完毕后,才进行render,这种逻辑在交互上就会出现,一开始地图为空,过了一段时间(资源加载完毕后)地图跳出。交互有些不够友好。
期望目标:地图分块加载,一块瓦片地图资源加载完毕后渲染到地图上。
egret开发者论坛上问题链接
如题
使用flash做的素材,使用createjs发布之后是素材文件+js文件。您提供的例子中的ts文件怎么来的?
现在官网没法下载[Egret Engine]了,求下载地址方法。mac系统
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.