基于layabox的微信端魔塔小游戏开发
摘要:在社会发展的今天,人们对于物质上的追求已经基本满足,开始寻求更多精神上的追求。疫情当下,游戏这一娱乐模式逐渐成为人们习惯的一种行为方式。而相对于大型网络游戏与普通APP手游的需要长期积累升级,下载后才能进行游戏的模式,小游戏体验轻便,无需下载,寄托于客户端的方式无疑为玩家开辟了一条新的快捷的方式,自微信小游戏推出后,头条,VO快应用等各大厂商紧随其后,掀起了中国全新5G时代下游戏的新浪潮,也是H5取代Flash游戏的大势所趋。本文旨在借助微信平台环境下,利用laya引擎,开发一套改编后的传统游戏—魔塔。
目前国内主流的H5游戏引擎主要有Cocos2d-js,Egret与Layabox。其中,Cocos2d-js在语言上仅支持js,且不支持3D渲染与VR发布,对日后向3D转换带来不便,而Layabobx在性能渲染上的综合实力较强,且内部支持多渠道游戏的发布。本文就是采用Layabox引擎下支持的TypeScript来设计的小游戏,利用FairyGUI进行游戏内部界面的设计,利用xlsxConvert工具将写在xlsx表中的游戏数据转换成json格式,利用Web Storage(web端),setStorage、getStorage(微信端)进行在玩家客户端中进行读取、存储玩家的基础数据。通过监听与取消监听相结合的方式进行游戏中的摇杆设计来操作角色移动,游戏地图采用数组的方式来记录,在玩家数据中存入各个地图的道具,怪物等信息,移动时进行事件判断。核心玩法为玩家与各种怪物战斗,战斗胜利后获得经验与金币提升自身属性,最后击杀最终BOSS取得胜利营救公主。最终完成的功能有地图怪物设计绘制,摇杆操作系统,地图跳跃系统,金币商城经验商城系统,角色与各种不同的属性类的碰撞事件系统,背包系统,战斗系统,数据存储系统。
关键词:智力游戏;魔塔;微信小游戏;LayaBox
中图分类号:TP311.1
Development of magic tower game on wechat based on layabox
Abstract:In today's social development, people's pursuit of material has been basically satisfied, and began to seek more spiritual pursuit. At present, game as an entertainment mode has gradually become a way of behavior that people are used to. Compared with the large-scale online games and ordinary app mobile games, which need to be accumulated and upgraded for a long time, the game mode can only be carried out after downloading. The small game experience is light and does not need to be downloaded. The way entrusted to the client undoubtedly opens up a new and fast way for the players. Since the launch of wechat small game, the top news, VO fast application and other major manufacturers have followed closely, setting off a new 5g era in China The new wave of game is also the trend of H5 replacing flash game. This paper aims to develop a set of adapted traditional game magic tower by using the Laya engine under the wechat platform environment.
At present, the mainstream H5 game engines in China mainly include cocos2d JS, egret and layabox. Among them, cocos2d JS only supports JS in language, and does not support 3D rendering and VR publishing, which is inconvenient for future 3D conversion, while layabobx has strong comprehensive strength in performance rendering, and internal support for multi-channel game publishing. This paper is a small game designed by typescript supported by layabox engine. Fairygui is used to design the internal interface of the game. Xlsxconvert tool is used to convert the game data written in xlsx table into JSON format. Web storage (web side), setstorage and getstorage (wechat side) are used to read and store the basic data of the player in the player client. Through the combination of monitoring and canceling monitoring, the rocker design in the game is designed to operate the role movement. The game map is recorded in the way of array, and the props, monsters and other information of each map are stored in the player's data, and the event judgment is carried out when moving. The core play method is that players fight with various monsters, gain experience and gold coins to improve their own attributes after winning the battle, and finally kill the boss to win and rescue the princess. Final functions include map Monster Design and drawing, rocker operating system, map jumping system, gold coin shopping mall experience shopping mall system, collision event system of roles and various attribute classes, backpack system, combat system and data storage system.
Keywords:Intellectual games;Magic tower;Wechat games;LayaBox
Classification: TP311.1
目 次
摘要 Ⅰ
目次 Ⅲ
1 绪 论 1
1.1 研究背景及意义 1
1.2 国内外研究现状 1
1.3 本文主要工作 2
1.4 本文组织结构 3
2 游戏的组成、玩家属性分析 4
2.1 游戏组成 4
2.1.1 机制(Mechanics) 4
2.1.2 故事(Story) 4
2.1.3 美学(Esthetics) 5
2.1.4 技术(Technology) 5
2.2 玩家属性分析 5
2.2.1 方块——成就型玩家 5
2.2.2 黑桃——探索型玩家 6
2.2.3 红桃——社交型玩家 6
2.2.4 梅花——杀手型玩家 7
2.2.5 总结 7
3 游戏分析与设计 8
3.1 需求分析 8
3.1.1 功能需求分析 8
3.1.2 非功能需求 9
3.2 可行性分析 9
3.2.1 技术可行性分析 9
3.2.2 经济可行性分析 9
3.3 游戏的总设计 9
3.4 功能模块设计 11
3.4.1 游戏存储模块 11
3.4.2 游戏分享模块 11
3.4.3 操作模块 11
3.4.4 界面模块 12
3.4.5 商城模块 12
3.4.6 碰撞模块 12
3.4.7 战斗模块 12
3.4.8 跳跃模块 12
3.4.9 音乐模块 12
3.4.10属性查看模块 12
3.4.11 背包模块 12
3.5 xlsx表设计 13
4 系统实现 15
4.1 数据初始化 15
4.2 功能模块实现 15
4.2.1 游戏存储模块 15
4.2.2 游戏分享模块 16
4.2.3 操作模块 17
4.2.4 界面模块 18
4.2.5 商城模块 18
4.2.6 碰撞模块 21
4.2.7 战斗模块 22
4.2.8 跳跃模块 23
4.2.9 音乐模块 25
4.2.10属性查看模块 21
4.2.11 背包模块 22
5 游戏测试 27
5.1 软件测试的重要性和目的 27
5.2 基于layabox的微信端魔塔小游戏功能测试 27
5.2.1 游戏外部功能测试 27
5.2.2 游戏内部功能测试 28
6 总结 31
参考文献 32