微信小程序----贪吃蛇

本文介绍了如何使用微信小程序开发一款贪吃蛇游戏,提供了游戏截图及完整的代码链接,帮助读者理解微信小程序在游戏开发中的应用。
摘要由CSDN通过智能技术生成

效果图:
在这里插入图片描述
代码:

<!--pages/snake/snake.wxml-->
<view id="snake" bindtouchstart="touchStart" bindtouchmove="touchMove" bindtouchend="touchEnd">
  <view class="score">
    <view class="score-box title">贪吃蛇</view>

    <view class="score-box score-detail">
      <text class="scoreDes">得分</text>
      <text class="scoreNum">{
  {score}}</text>
    </view>

    <view class="score-box score-detail">
      <text class="scoreDes">最高得分</text>
      <text class="scoreNum">{
  {maxScore}}</text>
    </view>
  </view>

  <view class="ground">
    <view wx:for="{
    {ground}}" wx:for-item="cols" class="rows">
      <view wx:for="{
    {cols}}" class="box box_{
    {item}}"></view>
    </view>
  </view>

  <modal class="modal" hidden="{
    {modalHidden}}" no-cancel bindconfirm="modalChange">
    <view>游戏结束,重新开始吗?</view>
  </modal>
</view>
/* pages/snake/snake.wxss */
#snake{
   
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.score{
   
  display: flex;
  margin: 20rpx;
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值