Giter Site home page Giter Site logo

bxm0927 / canvas-special Goto Github PK

View Code? Open in Web Editor NEW
2.3K 66.0 648.0 18.81 MB

:octocat::alien::star2:超多经典 Canvas 实例,动态离子背景、炫彩小球、贪吃蛇、坦克大战、是男人就下100层、心形文字等。

HTML 20.06% CSS 9.18% JavaScript 68.05% PHP 2.70%
html css js canvas

canvas-special's Issues

five chess

//判定食物是否出现在蛇身上,如果是重合,则重新生成一遍
var isOnSnake = true;
//设置食物出现的随机位置
while (isOnSnake) {
//执行后先将判定条件设置为false,如果判定不重合,则不会再执行下列语句
isOnSnake = false;
var indexX = getNumberInRange(0, canvas.width / 20 - 1);
var indexY = getNumberInRange(0, canvas.height / 20 - 1);
var rect = new Rect(indexX * 20, indexY * 20, 20, 20, "green");
for (var i = 0; i < snake.snakeArray.length; i++) {
if (snake.snakeArray[i].x == rect.x && snake.snakeArray[i].y == rect.y) {
//如果判定重合,将其设置为true,使随机数重给
isOnSnake = true;
break;
}
}
}
//返回rect,使得实例化对象food有draw的方法
return rect;

这段代码怎么避免食物出现在蛇上的

一个小bug

《是男人就下一百层》有一个小bug:踩到钉子上没有反应(和踩到平地一样)
希望能修复一下~ 感谢! QAQ

优秀

挺好的东西为什么没有留言

666

感谢分享!!!!

nb

大佬,作品很炫酷

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.