Function for adding object in Phaser

安稳与你 提交于 2020-01-07 03:19:25

问题


I need function like this, but for Phaser.

wade.addSceneObject(new SceneObject(dotSprite, 0, dotPosition.x, dotPosition.y)); 

回答1:


Based upon how I understand your question, I'd highly recommend looking at a Phaser tutorial before you go too much further. The official tutorials are really quite good.

Based upon the documentation for WADE I see that addSceneObject adds an object and SceneObject creates one. So, you want to know how to add a sprite to a game.

In Phaser this would be something like:

game.add.sprite(dotPosition.x, dotPosition.y, 'spriteKey');

The Add a Sprite demo shows how to load the image into the cache so it can be included on the page.



来源:https://stackoverflow.com/questions/43565163/function-for-adding-object-in-phaser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!