当前位置:网站首页>3.2 create menu and game pages (Part 2)
3.2 create menu and game pages (Part 2)
2022-07-26 11:50:00 【mfg_】
3.2 Create menus and game pages ( Next )
This class is based on the last class , Draw a snake in the picture .
Start... First vue Scaffolding ,
vue uiModify map
The question of last class ; The map size is 13x13 Of , In the beginning , Suppose the starting coordinates of two snakes are (11,1)(1,11);
Adjustment will not make two snakes enter the same grid at the same time ( It ends in a draw )
Make the map even x Odd number .Do not use axisymmetry , Use centrosymmetry .
// Create random obstacles
for (let i = 0; i < this.inner_walls_count / 2; i++) {
for (let j = 0; j < 1000; j++) {
let r = parseInt(Math.random() * this.rows);
let c = parseInt(Math.random() * this.cols);
// Change to centrosymmetry
if (g[r][c] || g[this.rows - 1 - r][this.cols - 1 - c]) {
continue;
}
if (r == this.rows - 2 && c == 1 || r == 1 && c == this.cols - 2)
continue;
// Change to centrosymmetry
g[r][c] = g[this.rows - 1 - r][this.cols - 1 - c] = true;
break;
}
}
Centrosymmetric figure 
Now the generated map , As soon as the browser is refreshed, a random one is generated for the convenience of debugging . Later, the backend will generate maps , The front end is only responsible for demonstrating animation .
Regulations : front 10 Step ( round ) The length of each snake increases 1 grid , After every 3 Step by step .
You need to convert the number of rows and columns into coordinates .
canvas Canvas and web page image coordinates are different .
Draw a snake
First step , Draw a moving ball .
Turn-based game ,
Copy the code against your scalp

final result

Use Google browser
Save to the cloud
git status
git add .
git commit -m " "
git push
边栏推荐
- 国内11所“袖珍”大学!在校园跑步,还没加速就出校门了...
- 开放原子开源基金会OpenHarmony工作委员会主席侯培新寄语OpenAtom OpenHarmony分论坛
- 数据库组成 触发器
- 忆凤姐
- [cloud resident co creation] decrypt how sparkrtc realizes ultra-low latency interaction globally
- 【云驻共创】解密SparkRTC如何在全球实现超低时延交互
- PostgreSQL在Linux和Windows安装和入门基础教程
- 建模杂谈系列150 SCLC工程化实验3-SRule
- swagger2.9.2教程 与swagger3.0.0教程
- 沟通中经常用到的几个库存术语
猜你喜欢
随机推荐
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
初试YOLOv7
Record errors encountered by individuals
FINEOS宣布2022年GroupTech Connect活动开放注册
Which is faster to open a file with an absolute path than to query a database?
【附下载】一款强大的Web自动化漏洞扫描工具——Xray
【通信原理】第一章 -- 绪论
PostgreSQL in Linux and windows installation and introductory basic tutorial
[communication principle] Chapter 2 -- deterministic signal
Data Lake (19): SQL API reads Kafka data and writes it to iceberg table in real time
Win10 uses NVM to install node, NPM, and cnpm
Application scheme of ankerui residual pressure monitoring system in residential quarter
忆凤姐
系统调用捕获和分析—修改内核方法添加系统调用
李宏毅《机器学习》丨2. Regression(回归)
10 reduce common "tricks"
浅谈低代码技术在物流运输平台中的搭建与管理
System call capture and analysis - modify kernel methods to add system calls
Preliminary test yolov7
梅科尔工作室-华为14天鸿蒙设备开发实战笔记八

Do not use axisymmetry , Use centrosymmetry .
You need to convert the number of rows and columns into coordinates .









