飞行棋游戏的设计与实现(8)
时间:2026-01-20
时间:2026-01-20
Else '巡航航线上坐标计算 GmData.Plan(Player_Idx,
Plan_Idx).Idx_Abs + Dice_Num End If Plan_Idx).Idx_Abs
GmData.Plan(Player_Idx,
SetRlat_Idx Player_Idx, Plan_Idx End Sub
3 SetRlat_Idx()根据绝对索引号计算相对索引号 根据各棋子的偏移量和绝对索引号计算得出结果
Private Sub SetRlat_Idx(Player As Long, Plan As Long)
If GmData.Plan(Player, Plan).Stat = OnTheWay Then
GmData.Plan(Player, Plan).Idx_Rlat = (GmData.Player(Player).Start
GmData.Plan(Player, Plan).Idx_Abs) Mod GmData.Num_Round '棋子相对坐标
Else End If End Sub +
GmData.Plan(Player, Plan).Idx_Rlat = -1
4 GetLanding_Idx() 计算
主要是完成一个棋子回走的功能
Private Function GetLanding_Idx(Idx_Abs As Long, Dice As Long) As Long
GetLanding_Idx = Idx_Abs + Dice
If GetLanding_Idx > 55 Then '回走 End If End Function
GetLanding_Idx = 110 - GetLanding_Idx
5 Attack() 攻击一定范围内的其他玩家棋子
这是飞行棋中关键的模块之一,此模块根据玩家所选的棋子,攻击指定范围内的其 他玩家棋子,并作相关统计
6 MovePlan() 移动棋子
这是飞行棋中关键的模块之一,此模块负责移动玩家所选的棋子,并执行移动后可能 对遇到的特殊动作。
7 DoFlyAndJump()、DoJump()、DoFly()飞行和条约相关模块
在游戏中,飞行和跳跃有一定的共同点,不同的是触发条件和优先级有所区别而已, 因此用一个DoFlyAndJump() 来统筹这个功能,下面的DoJump()和 DoFly()仅仅是为方便前
者而写
8 FallingDown() 让指定棋子坠毁 让指定棋子坠毁
指定的棋子坠毁后更新玩家相关数据,并且该棋子自动回到机场,等待下次起飞。
下一篇:大学语文12——论快乐