C#游戏编程:《控制台小游戏系列》之《推箱子》

unɟ4ǝpoɔ 专栏收录该内容
3 篇文章 0 订阅

##编辑一下看看csdn支持markdown没有

`测试`

经典的《推箱子》游戏:





/*
 * /
 * Program : ConsoleSokabanGame
 * Author  : hwenycocodq520 (hwenycocodq520#163.com)
 * Date    : 2014/3/27
 * Resume  : 推箱子游戏
 * 
 * /
 * Modifiy History
 * 
 * Date    :
 * Resume  :
 * 
 */
using Hweny.ConsoleGame;
using Hweny.ConsoleSokaban.GameStates;
using System.Configuration;
namespace Hweny.ConsoleSokaban
{
    public class ConsoleSokabanGame : Game
    {
        private GameStage stage;
        //where are data?
        private string WRD = string.Empty;

        protected override void Start()
        {
            engine.Initialize("ConsoleSokabanGame v1.0 by hwenycocodq520");

            int fpsValue;
            if (!int.TryParse(ConfigurationManager.AppSettings["Fps"].ToString(), out fpsValue))
                fps = 15;
            else
                fps = fpsValue;

            WRD = ConfigurationManager.AppSettings["LevelData"].ToString();
            stage = new GameStage(WRD);

            var renderer = new SokabanRenderer(engine.Graphics, stage);
            var controller = new SokabanController(stage, renderer, engine);

            engine.StateMgr.AddState(new GameMenuState(engine));
            engine.StateMgr.AddState(new GameMenuCreatorState(engine));
            engine.StateMgr.AddState(new GameMenuIntroduceState(engine));
            engine.StateMgr.AddState(new GameLevelSelectState(engine, stage));
            engine.StateMgr.AddState(new GamePlayState(engine, controller));
            engine.StateMgr.AddState(new GameWinningState(engine, 100));
            engine.StateMgr.AddState(new GamePassState(engine, stage));
            engine.StateMgr.Push<GameMenuState>();
        }

        protected override void Cleanup()
        {
            if (stage != null)
            {
                stage.LevelMgr.SaveLevels(WRD);
            }
            base.Cleanup();
        }
    }
}


download: http://download.csdn.net/detail/hwenycocodq520/7104973

  • 8
    点赞
  • 7
    评论
  • 5
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值