【8.关卡游戏】7.关卡设计

发布时间:2024-06-17 16:44:24 浏览量:144次

重新定义游戏趣味!优化关卡设计策略

玩游戏就是要有乐趣!游戏的关卡设计不仅要根据游戏进度调整难易程度,还要确保玩家在游戏中获得持续的成就感。

在游戏创作中,关卡设计涉及以下核心要素:

  • 关卡的难度设置
  • 游戏地图的设计

本节小游戏的关卡设计以难度调整为核心。关卡难度的三大参数包括:

  • 道具生成频率
  • 道具下落速度
  • 苹果与炸弹的比例配置

这三项参数的调整通过脚本生成器实现,现在我们将在调度器脚本中调用这些设定。

关卡设计方案:

关卡

剩余时间

道具生成频率

道具下落速度

炸弹比例

第一关

60秒

1秒

-0.03

20%

第二关

50秒

0.7秒

-0.04

40%

第三关

30秒

0.5秒

-0.06

60%

超过 500 分即可通关,开启下一关挑战!完成第三关后,游戏将重新开始。倒计时结束时若未通关,将重新挑战当前关卡。

7.1创意设计!关卡界面优化指南

在UI界面选择创建 -> UI -> 文本,命名为“Pass”。将“Pass”设置在右上角显示。

选中“Pass”,在属性窗口中进行如下设置:

锚点:右上角

位置参数 PosX、PosY、PosZ 分别为 -70、-115、0,宽度、高度分别设定为 160、40

文本内容:“No.1”,字体大小 32,水平垂直对齐方式为居中

7.2挑战关卡设计任务

以下为设计代码:

  using System.Collections;  using System.Collections.Generic;  using UnityEngine;  using UnityEngine.UI;  public class GameDirector : MonoBehaviour  {      GameObject timerText;      GameObject pointText;      GameObject passText;      GameObject itemGenerator;      float time = 60.0f;      int point = 0;      int pass = 1;      public void GetApple()      {          point += 100;      }      public void GetBomb()      {          point /= 2;      }      // 游戏开始前执行      void Start()      {          timerText = GameObject.Find("Time");          pointText = GameObject.Find("Point");          passText = GameObject.Find("Pass");          itemGenerator = GameObject.Find("ItemGenerator");          passText.GetComponent<Text>().text = "No." + pass.ToString();      }      // 每帧更新一次      void Update()      {          time -= Time.deltaTime;          timerText.GetComponent<Text>().text = time.ToString("F1");          pointText.GetComponent<Text>().text = point.ToString() + " 分";          passText.GetComponent<Text>().text = "No." + pass.ToString();          // 切换关卡          if (point >= 500 || time <= 0)          {              // 关卡结束              if (point >= 500)               {                  if (pass < 3) pass++; else pass = 1;                        }                          point  = 0;                            if (pass == 1)               {                  itemGenerator.GetComponent<ItemGenerator>().SetParameters(1, 2, -0.03f);                  time = 60.0f;              }              else if (pass == 2)               {                  itemGenerator.GetComponent<ItemGenerator>().SetParameters(0.7f, 4, -0.04f);                  time = 50.0f;              }               else if (pass == 3)              {                  itemGenerator.GetComponent<ItemGenerator>().SetParameters(0.5f, 6, -0.06f);                  time = 30.0f;              }          }      }  }  



关于火星时代教育:

火星时代教育是一家专注数字艺术教育的培训机构,成立于30年前,致力于为学习者提供游戏设计、游戏程序、动画制作、UI设计等多种课程培训。点击咨询,探索更多创意无限的数字艺术世界!

热门课程推荐

热门资讯

请绑定手机号

x

同学您好!

您已成功报名0元试学活动,老师会在第一时间与您取得联系,请保持电话畅通!
确定