当前位置:网站首页>教你快速开发一个 狼人杀微信小程序(附源码)
教你快速开发一个 狼人杀微信小程序(附源码)
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
边栏推荐
- box-sizing
- Unlock openharmony technology day! The annual event is about to open!
- XinChaCha Trust SSL Organization Validated
- C#,二维贝塞尔拟合曲线(Bézier Curve)参数点的计算代码
- Fashion cloud learning - input attribute summary
- SSM框架系列——注解开发day2-2
- S2-062 remote command execution vulnerability recurrence (cve-2021-31805)
- box-sizing
- [csnote] ER diagram
- I changed to a programmer at the age of 31. Now I'm 34. Let me talk about my experience and some feelings
猜你喜欢

Redis deployment of cloud native kubesphere

梳理网络IP代理的几大用途

基于卷积神经网络的遥感影像分类识别系统

Unlock openharmony technology day! The annual event is about to open!

风尚云网学习-input属性总结

Can I take the CPDA data analyst certificate for 0 foundation

消息队列概述

标签与路径

How do traditional enterprises cope with digital transformation? These books give you the answer

Unable to create servlet under SRC subfile of idea
随机推荐
Remote sensing image classification and recognition system based on convolutional neural network
Buuctf Web [bjdctf2020] zjctf, but so
Source code analysis of synchronousqueue
云原生KubeSphere部署Mysql
Deploying MySQL in cloud native kubesphere
[wechat applet] Z-index is invalid
Redis deployment of cloud native kubesphere
解决disagrees about version of symbol device_create
Introduction to metalama 4 Use fabric to manipulate items or namespaces
STM32 project transplantation: transplantation between chip projects of different models: Ze to C8
Image attribute of input: type attribute of fashion cloud learning -h5
BUUCTF WEB [BJDCTF2020]The mystery of ip
What are the forms of attack and tampering on the home page of the website
Object.keys后key值数组乱序的问题
SSM framework series - JUnit unit test optimization day2-3
风尚云网学习-h5的input:type属性的image属性
Message queuing overview
航芯技术分享 | ACM32 MCU安全特性概述
How much does software testing help reduce program bugs?
天梯赛赛前练习