游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1716|回复: 1

【飞行棋】请问如何定义飞行棋的棋盘?

[复制链接]

1

主题

1

帖子

7

积分

新手上路

Rank: 1

积分
7
发表于 2008-1-31 11:41:00 | 显示全部楼层 |阅读模式
棋盘就是最经典的那种棋盘。
四个起飞点
四个返航航线
公用环形航线

17

主题

166

帖子

174

积分

注册会员

Rank: 2

积分
174
发表于 2008-2-1 13:19:00 | 显示全部楼层

Re: 【飞行棋】请问如何定义飞行棋的棋盘?


class grid_t;//提前声明
class player_t;//提前声明

const int max_players = 4;

class chess_t//一枚棋子
{
        int state;//在起点 = 0
                          //飞行中 = 1
                          //在终点 = 2
        player_t* _owner;//所属玩家
};

class grid_t//一个格子
{
        chess_t* _the;//格子上的棋子,未考虑多枚棋子的情况
        virtual int move();//默认为 移动到下一格
};

class end_grid_t : public grid_t//连接到返航航线的格子
{       
        int _color;//对应飞机的颜色
        airline_t* _end;//对应的返航航线
        virtual int move();//移动到 返航航线 的第一格中
};

class distination_t : public grid_t//终点
{
        virtual int move();//改变棋子状态为 在终点
};

class airline_t//航线
{
   vector<grid_t*> _airline;
};

class player_t
{
        class start_point_t//起飞点
        {
                grid* _to_airline;//连接到环形航线的格子
        };
        int roll();//给我来个6吧
        int take_turn();//轮到我走
        int _color;
        start_point_t _start;
        vector<chess_t> _chesses;
};


airline_t _end_lines[max_players];//返航航线
airline_t _public_line;//公用环形航线
player  _players[max_players];//玩家
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-19 23:40

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表