js实现简单的围棋

代码语言:html

所属分类:游戏

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>

    <script src="http://repo.bfw.wiki/bfwrepo/js/easeljs-0.7.1.min.js"></script>
    <script>

        function Circle() {
            createjs.Shape.call(this);
            this.setCircleType = function(type) {
                this._circleType = type;
                switch (type) {
                    case Circle.TYPE_UNSELECTED:
                        this.setColor("#cccccc");
                        break;
                    case Circle.TYPE_SELECTED:
                        this.setColor("#ff6600");
                        break;
                    case Circle.TYPE_CAT:
                        this.setColor("#0000ff");
                        break;
                }
            }

            this.setColor = function (colorString) {
                this.graphics.beginFill(colorString);
                this.graphics.drawCircle(0, 0, 25);
                this.graphics.endFill();
            }
            this.getCircleType = function() {
                return this._circleType;
            }
            this.setCircleType(1);
        }
        Circle.prototype = new createjs.Shape();
        Circle.TYPE_UNSELECTED = 1;
        Circle.TYPE_SELECTED = 2;
        Circle.TYPE_CAT = 3;

    </script>

</head>
<body>

    <div style="width:530px;margin:0 auto;">
        <canvas width="530px" height="500px".........完整代码请登录后点击上方下载按钮下载查看

网友评论0