在相位器中添加对象的功能 [英] Function for adding object in Phaser

查看:85
本文介绍了在相位器中添加对象的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这样的功能,但对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆