Function for adding object in Phaser

2019-08-21 02:47发布

I need function like this, but for Phaser.

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

1条回答
淡お忘
2楼-- · 2019-08-21 03:13

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.

查看更多
登录 后发表回答