Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhenglinlei/stackblock.io
.io minigame
https://github.com/zhenglinlei/stackblock.io
cannonjs game javascript threejs
Last synced: 14 days ago
JSON representation
.io minigame
- Host: GitHub
- URL: https://github.com/zhenglinlei/stackblock.io
- Owner: ZhengLinLei
- License: apache-2.0
- Created: 2022-02-13T11:16:51.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-28T08:47:35.000Z (9 months ago)
- Last Synced: 2024-05-28T23:02:44.568Z (9 months ago)
- Topics: cannonjs, game, javascript, threejs
- Language: JavaScript
- Homepage: https://zhenglinlei.github.io/stackblock.io
- Size: 4.25 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
> Finding support and maintenance
>
> Collab with us [ISSUES](https://github.com/ZhengLinLei/stackblock.io/issues) and FORKStackBlock.io
Live web preview [here](https://zhenglinlei.github.io/stackblock.io)
![]()
## ๐ Source Code
The main project file code in `./js/script.js`.
This project was made with the help of:
* Three.js
* Cannon.jsCDN:
```HTML```
## ๐ฎ Bot testing
To activate the bot testing, you only need to write in console `playBot([relation:float], [time:int])`, by default the parameters are *0.9* and *20ms*
Or you can set it manually:
```javascript
let botTimer = setInterval(()=>{
const lastLayer = stackBoxArr[stackBoxArr.length -1];
const previousLayer = stackBoxArr[stackBoxArr.length -2];
// LAST LAYER DIRECTION
let lastDirection = lastLayer.direction;
// CALCULATE OUTBOX
let delta = lastLayer.threejs.position[lastDirection] - previousLayer.threejs.position[lastDirection] // !NOTE: THE BOTH BOX MUST BE CALCULATED WITH THE SAME DIRECTION
let alpha = Math.abs(delta); // GET POSITIVE NUM
// CALCULATE OUTBOX WIDTH DEPTH
let outbox = (lastDirection === "x")? lastLayer.width : lastLayer.depth;
let inbox = outbox - alpha;
const boxRelation = inbox / outbox; // 0 to 1
if(boxRelation >= 0.9){
document.body.click();
console.log(boxRelation); // OUTPUT
}
}, 20);
```### Love this repo? Give us a star โญ