使用Flixel创建用户界面 [英] Creating user UI using Flixel

查看:102
本文介绍了使用Flixel创建用户界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是游戏开发的新手,但熟悉编程语言.我已经开始使用Flixel,并拥有一款具有得分和生活能力的Breakout游戏.

I am new to game development but familiar with programming languages. I have started using Flixel and have a working Breakout game with score and lives.

我要做的是在实际加载游戏之前添加开始"屏幕.

What I am trying to do is add a Start Screen before actually loading the game.

我有一个create函数,将所有游戏元素添加到舞台上

I have a create function that adds all the game elements to the stage:

override public function create():void
   // all game elements
{

如何添加此预加载的开始屏幕?我不确定是否必须将代码添加到此create函数中或其他地方以及要实际添加的代码.

How can I add this pre-load Start Screen? I'm not sure if I have to add in the code to this create function or somewhere else and what code to actually add.

最终我也想添加保存,加载,选项和升级.因此,任何有关此的建议都很好.

Eventually I would also like to add saving, loading, options and upgrades too. So any advice with that would be great.

这是我主要的游戏.:

package
{
    import org.flixel.*;

    public class Game extends FlxGame
    {
        private const resolution:FlxPoint = new FlxPoint(640, 480);
        private const zoom:uint = 2;
        private const fps:uint = 60;

        public function Game()
        {
            super(resolution.x / zoom, resolution.y / zoom, PlayState, zoom);
            FlxG.flashFramerate = fps;
        }
    }
}

谢谢.

推荐答案

我通常的处理方式是使用其他FlxState-我在菜单",游戏本身和游戏结束"屏幕上使用了它.

The way that I usually do it is with a different FlxState - I use one for "Menu", the game itself, and the Game Over screen.

因此,创建一个扩展FlxState的新类,将其称为"MenuState",然后说:

So make a new class that extends FlxState, call it maybe "MenuState" and then say:

super(resolution.x / zoom, resolution.y / zoom, MenuState, zoom);

在MenuState内部,按一下按钮或类似内容,

Inside MenuState, on a button press or something, say:

FlxG.switchState(PlayState);

这篇关于使用Flixel创建用户界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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