在相位器中添加对象的功能 [英] Function for adding object in Phaser
问题描述
我需要这样的功能,但对于Phaser.
I need function like this, but for Phaser.
wade.addSceneObject(new SceneObject(dotSprite, 0, dotPosition.x, dotPosition.y));
推荐答案
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.
根据WADE的文档,我看到 addSceneObject
添加了一个对象,并且<一个href ="http://clockworkchilli.com/docs/SceneObject" rel ="nofollow noreferrer"> SceneObject
创建一个.因此,您想知道如何向游戏中添加精灵.
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.
在Phaser中,它类似于:
In Phaser this would be something like:
game.add.sprite(dotPosition.x, dotPosition.y, 'spriteKey');
添加Sprite演示显示了如何加载图像进入缓存,以便可以将其包含在页面中.
The Add a Sprite demo shows how to load the image into the cache so it can be included on the page.
这篇关于在相位器中添加对象的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!