haxeflixel吧 关注:5贴子:6
  • 0回复贴,共1

用haxeflix创建一个 helloworld

只看楼主收藏回复

Create a new HaxeFlixel Project Template
创建一个 HaxeFlixel Project 模板。
在命令行模式输入 flixel tpl -n "HelloWorld"
此时会在当前文件夹创建一个 helloWorld的文件夹,并且包含自动创建的许多文件。
添加 "Hello World" FlxText:
打开MenuState.hx文件,
可以看到文件内容:
package;import flixel.FlxG;import flixel.FlxSprite;import flixel.FlxState;import flixel.text.FlxText;import flixel.ui.FlxButton;import flixel.util.FlxMath;/** * A FlxState which can be used for the game's menu. */class MenuState extends FlxState{ /** * Function that is called up when to state is created to set it up. */ override public function create():Void { super.create(); } /** * Function that is called when this state is destroyed - you might want to * consider setting all objects this state uses to null to help garbage collection. */ override public function destroy():Void { super.destroy(); } /** * Function that is called once every frame. */ override public function update():Void { super.update(); } }
添加 add(new FlxText(0, 0, 100, "Hello World!")); 代码到 create() 方法中,super.create():之前。
在命令行添加以下命令
lime test flash
即可出现flashplayer运行。


IP属地:江苏1楼2014-05-30 08:38回复