Comments (20)
确实没有考试多点触摸的问题。可以考虑写一个全局变量来判断是否有模块被 touch 了,如果有就强制把这个模块释放。这几天会修复这个问题
from puzzle.
好的谢谢!
from puzzle.
@nbauser 已经支持多点触摸了
from puzzle.
@leeenx 好的我去试一下,谢谢
from puzzle.
你好,想问一下https://www.jigsawplanet.com/?rc=play&pid=19359046deb6这个效果,在你的基础上好实现嘛,对于模块合并移动没什么思路
from puzzle.
@nbauser 模块合并就是两两个模块放到同一个容器中,然后这个容器就变成了新的模块,移动这个容器就是移动合并后的模块。如果要在我的基础上实现,那么逻辑会有些大改动,因为我的方案跟你给的那个游戏不太一样。不过我的游戏里也有类似的合并模块的概念,只是没有做可移动
from puzzle.
如果是我给那个游戏效果的话,你代码中根据起始位置的容差判断吸附效果就没有办法实现,这一点有什么好思路嘛。
from puzzle.
难道要遍历判断周围每个模块的位置嘛?
from puzzle.
@nbauser 你可以用相对位置 + 网格的思路来做,这样就不用遍历。相当于把我现在的这套东西做一个扩展。话说你是要用这个东西来做业务吗?
from puzzle.
对啊,想在你这个基础上做东西,之前没接触过pixi.js,只能边看边做了。感谢你的帮助
from puzzle.
吸附效果已经做好了,但是对于合并模块移动这个地方不是很明白,能说一下思路嘛?
from puzzle.
PIXI 可以创建一个 container,把合并后的拼图小块放进去,然后移动的时候就操作这个 container 就好了。不过,前提要跟你说一下,我当前的这个项目做了个半透明的底图吸附,如果你要做合并模块移动的话,需要先把这一块东西给干掉
from puzzle.
对的,我现在已经去掉半透明底图吸附了,现在就是考虑合并模块的移动,谢谢。
from puzzle.
你好我想问一下关于合并之后的模块怎么实现吸附呢?我的想法是根据移动的模块算出移动数值,然后更新模块中的每一个sprite,但是实际实现起来好像算出来的并不是我想要的数值。
from puzzle.
你好又打扰你了,想问你这个问题看看:
这个位置的x,y轴是正常的,但是使用
activeClipart.sprite.set({
top: activeClipart.selected.top,
left: activeClipart.selected.left,
rotate: activeClipart.selected.rotate
});
同步(合并模块中的sprite)left、top的时候,模块并没有按照坐标的位置填充,发生了错位,对于这个问题你有思路嘛?
from puzzle.
是不是新的new PIXI.Container()中对于sprite中的left和top属性需要对应有所改变?
from puzzle.
@nbauser 坐标系是需要转换的。你给我的的代码片段,时间隔得有点久,记不太清楚了。你可以把 rotate 这个值取消了,好像不太适合你当前的项目,你要实现的需求好像不太难,我这几天比较忙,周末看一下给你写个 demo
from puzzle.
rotate这个需求是有的,现在是需要对新的new PIXI.Container()的坐标系同步的问题,pixi.js的文档看起来不太友好。
from puzzle.
这个是新建的Container
parent = new PIXI.Container();
// 与 puzzle 容器保持一致
parent.set({
x: this.puzzle.x,
y: this.puzzle.y,
pivotX: this.puzzle.pivotX,
pivotY: this.puzzle.pivotY,
scaleX: this.puzzle.scaleX,
scaleY: this.puzzle.scaleY
});
在舞台拖动事件结束之后同步模块中sprite的位置信息
clipart.x0 = clipart.selected.left;
clipart.y0 = clipart.selected.top;
clipart.sprite.set({
left: clipart.selected.left,
top: clipart.selected.top,
});
但是实际上这个left、top属性都有点问题,所以想问一下问题出在哪里?
from puzzle.
你好,关于前面说的问题,已经解决了,谢谢你的帮助!!!
from puzzle.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puzzle.