当前位置:网站首页>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
边栏推荐
- Which is faster to open a file with an absolute path than to query a database?
- MongoDB-使用$type查询某个字段的类型是否为xxx
- Hashtable
- 【安徽大学】考研初试复试资料分享
- Marriage seeking story
- Colt DCS is serious about building a green data center!
- FINEOS宣布2022年GroupTech Connect活动开放注册
- 滴滴被罚80亿!拿用户数据赚钱的时代结束了
- 你敢信?开发一个管理系统我只用了两天时间
- ESP8266-Arduino编程实例-开发环境搭建(基于PlatformIO)
猜你喜欢

Pyechart offline deployment

Harbor2.2 用户角色权限速查

GA-RPN:引导锚点的建议区域网络

Practice of microservice in solving Library Download business problems

Pytoch -- error based on mmseg/mmdet training: runtimeerror: expected to have finished reduction in the priority iteration

X 2 Earn必须依靠旁氏启动?Gamefi的出路在哪?(上)

28. Implementation of file directory parsing code

System call capture and segmentation - RING3 layer LD_ Preload mechanism for library function hijacking

Redis database, which can be understood by zero foundation Xiaobai, is easy to learn and use!

Exploration on cache design optimization of community like business
随机推荐
Live broadcast preview at 19:30 on July 27: harmonyos3 and Huawei's full scene new product launch
系统调用捕获和分析完结篇制作系统调用日志收集系统
Creation and modification of basic tables and data in them by SQL statements of SQL Server
你敢信?开发一个管理系统我只用了两天时间
Pyechart离线部署
10 reduce common "tricks"
28. Implementation of file directory parsing code
Didi was fined 8billion! The era of making money from user data is over
武林头条-建站小能手争霸赛
Recalling Sister Feng
[idea] how to create a new project
ESP8266-Arduino编程实例-开发环境搭建(基于PlatformIO)
『MongoDB』MongoDB高可用部署架构——复制集篇(Replica Set)
Query summary of SQL Server
Swagger2.9.2 tutorial and swagger3.0.0 tutorial
PostgreSQL在Linux和Windows安装和入门基础教程
[communication principle] Chapter 3 -- random process [i]
查询进阶 别名
服务器内存故障预测居然可以这样做!
零基础小白也能懂的 Redis 数据库,手把手教你易学易用!

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