[英]Phaser 3 arcade physics world wraparound
I'm trying to make an Asteroids game in Phaser 3 (javascript) using the Arcade Physics engine. 我正在尝试使用Arcade Physics引擎在Phaser 3(javascript)中制作Asteroids游戏。
I want the effect where objects that leave one side of the screen come back from the opposite side. 我想要离开屏幕一侧的对象从另一侧回来的效果。
The API documentation describes a function here that allows you to "Wrap an object's coordinates (or several objects' coordinates) within Phaser.Physics.Arcade.World#bounds." API文档在此处描述了一个函数,该函数使您可以“在Phaser.Physics.Arcade.World#bounds中包装对象的坐标(或几个对象的坐标)”。
I am having trouble implementing it. 我在执行它时遇到了麻烦。 I have a group for the asteroids called asteroids.
我有一个小行星小组,叫做小行星。 Currently my implementation is
this.physics.world.wrap(asteroids);
目前,我的实现是
this.physics.world.wrap(asteroids);
however this does not get the desired effect. 但是,这并没有达到预期的效果。
原来我只是在错误的地方打电话-我将通话从创建功能移到了更新功能,一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.