当前位置:网站首页>教你快速开发一个 狼人杀微信小程序(附源码)
教你快速开发一个 狼人杀微信小程序(附源码)
2022-04-23 12:47:00 【Java笔记虾】
点击关注公众号,利用碎片时间学习
一、项目展示
狼人杀是一款多人参与的,通过语言描述推动、较量口才和分析判断能力的策略类桌面游戏
玩家人数适于4-18人参与
主要角色有:狼人 、预言家 、平民 、女巫 、猎人 、白痴 、守卫 、骑士等

同时还有众多的玩家形象

各角色的职能介绍

设置游戏人数和选择对应角色

开启游戏环节

二、首页
首页是选择游戏人数的页面
不同人数会分配不同的角色数量
常驻角色有狼人、村民、预言家、女巫、猎人
当游戏人数达到11人时将出现丘比特
UI代码如下:
<!--index.wxml-->
<view class="container">
<view class="setting">
<image class="logo" src="{
{logo}}"></image>
<form action="">
<picker range="{
{array}}" value="{
{index}}" bindchange="gameNumberChange">
<text class="picker">选择游戏人数:</text>
<text wx:if="{
{array[index] < 10}}">{
{" " + array[index]}}</text>
<text wx:else>{
{array[index]}}</text>
</picker>
<view class="role-config" wx:for="{
{config}}">
<image class="role-logo" src="{
{item.role.logo}}"></image>
{
{item.role.name}} x {
{item.count}}
</view>
</form>
</view>
<button type="primary" bindtap="startGame">开始游戏</button>
</view>
效果如下:

三、游戏页
在进入游戏界面之前,玩家需要抽取自己对应的角色牌
之后才是跳转到游戏的界面
角色选取界面部分代码如下:
<view class="container">
<block wx:if="{
{isChoosing}}">
<view class="inner-container">
<view class="swiper-indicator">{
{swiperCurrent}}/{
{roles.length}}</view>
<swiper bindchange="swiperCurrentChange">
<block wx:for="{
{roles}}">
<swiper-item>
<view class="item-container">
<view class="side-space"></view>
<image src="{
{cover}}" class="cover"></image>
<view class="side-space"></view>
</view>
</swiper-item>
</block>
</swiper>
</view>
<button type="primary" bindtap="chooseRole">选择这张牌</button>
</block>
<block wx:else>
<view class="inner-container">
<view class="role-logo-container">
<image src="{
{choosedRole.logo}}" class="role-logo" animation="{
{roleLogoAnimationData}}"></image>
</view>
<view class="role-name">你的角色是: {
{choosedRole.name}}</view>
<view class="role-description">{
{choosedRole.description}}</view>
</view>
<button type="primary" bindtap="setReady">准备好了</button>
</block>
</view>
效果展示:

进入游戏后,有多个白天黑夜的转换环节,狼人可以在黑夜中淘汰选手
效果如下:

四、特殊角色
上面的效果是普通村民和狼人的
其中,神职人员有着不同的技能
首先是女巫
女巫有两瓶药,一瓶救命一瓶杀人

另外是猎人
猎人在每轮可以猎杀掉一名玩家

最后
下载链接(需要CSDN的积分):
https://download.csdn.net/download/ws15168689087/83644749
来源:https://blog.csdn.net/ws15168689087
推荐:
PS:因为公众号平台更改了推送规则,如果不想错过内容,记得读完点一下“在看”,加个“星标”,这样每次新文章推送才会第一时间出现在你的订阅列表里。点“在看”支持我们吧!
版权声明
本文为[Java笔记虾]所创,转载请带上原文链接,感谢
https://javazhiyin.blog.csdn.net/article/details/124357902
边栏推荐
- 基于卷积神经网络的遥感影像分类识别系统
- Trier les principales utilisations de l'Agent IP réseau
- Qt一个进程运行另一个进程
- Basic software testing Day2 - Case Execution
- Ad20 supplementary note 3 - shortcut key + continuous update
- A graphic designer's fantasy world | ones characters
- Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
- Qt双缓冲绘图
- BUUCTF WEB [GXYCTF2019]禁止套娃
- NPDP|产品经理如何做到不会被程序员排斥?
猜你喜欢
SSL证书退款说明
Aviation core technology sharing | overview of safety characteristics of acm32 MCU
航芯技术分享 | ACM32 MCU安全特性概述
梳理網絡IP代理的幾大用途
Fashion cloud learning - input attribute summary
Dialogue with Bruce, author of PostgreSQL: "changing careers" is to better move forward
风尚云网学习-input属性总结
SSM框架系列——注解开发day2-2
box-sizing
4.DRF 权限&访问频率&过滤&排序
随机推荐
Source code analysis of synchronousqueue
对话PostgreSQL作者Bruce:“转行”是为了更好地前行
mysql中 innoDB执行过程分析
box-sizing
栈和队列a
Qt绘制图像
[daily question] chessboard question
Kubernets Getting started tutoriel
BUUCTF WEB [BUUCTF 2018]Online Tool
MySQL函数-递归函数
BUUCTF WEB [BUUCTF 2018]Online Tool
STM32控制步进电机(ULN2003+28byj)
RT-thread中关键词解释及部分API
Number of nodes of complete binary tree
Try the server for one month for free, and attach the tutorial
Use source insight to view and edit source code
梳理网络IP代理的几大用途
Uni app native app cloud packaging integrated Aurora push (jg-jpush) detailed tutorial
98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
Qt双缓冲绘图