game/shit/js/chainrxn.js

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

var chainrxn = false;
Ball = new Class({
	number: 0,
	xposition: 0,
	yposition: 0,
	downspeed: 0,
	rightspeed: 0,
	color: "#fff",
	srcs: "vapp/shit.png",
	radius: 0,
	expanding: 0,
	sizeChangeCount: 0,
	disabled: false,
	expanded: false,
	chainlevel: 0,
	initialize: function (gameLevel, number, xposition, yposition) {
		this.number = number;
		this.gameLevel = gameLevel;
		this.radius = this.gameLevel.ballSize;
		if(xposition == null) {
			this.xposition = (this.gameLevel.xmax - 2 * this.gameLevel.ballSize) * Math.random() + this.gameLevel.ballSize;
			this.yposition = (this.gameLevel.ymax - 2 * this.gameLevel.ballSize) * Math.random() + this.gameLevel.ballSize;
			var direction = Math.random() * 360;
			this.downspeed = Math.cos(direction) * this.gameLevel.ballSpeed;
			this.rightspeed = Math.sin(direction) * this.gameLevel.ballSpeed;
			this.color = "rgb(" + Math.round(255 * Math.random()) + ", " + Math.round(255 * Math.random()) + ", " + Math.round(255 * Math.random()) + ")";
		} else {
			this.xposition = xposition;
			this.yposition = yposition;
			this.color = "rgb(150,150,150)";
			this.startExpansion();
		}
		this.gameLevel.movingBalls.push(this);
		this.draw();
	},
	move: function () {
		this.xposition += this.rightspeed;
		this.yposition += this.downspeed;
		this.draw();
		var notHit = true;
		this.gameLevel.expandedBalls.each(function (expandedBall) {
			if(notHit && this.gameLevel.movingBalls[expandedBall].expanded == true && Math.sqrt(Math.pow(this.gameLevel.movingBalls[expandedBall].xposition - this.xposition, 2) + Math.pow(this.gameLevel.movingBalls[expandedBall].yposition - this.yposition, 2)) <= this.radius + this.gameLevel.movingBalls[expandedBall].radius) {
				this.chainlevel = this.gameLevel.movingBalls[expandedBall].chainlevel + 1;
				this.startExpansion();
				notHit = false;
			}
		}.bind(this))
		if(notHit) {
			if(this.xposition <= this.gameLevel.ballSize || this.xposition >= this.gameLevel.xmax - this.gameLevel.ballSize) {
				this.rightspeed = -1 * this.rightspeed;
			}
			if(this.yposition <= this.gameLevel.ballSize || this.yposition >= this.gameLevel.ymax - this.gameLevel.ballSize) {
				this.downspeed = -1 * this.downspeed;
			}
		}
	},
	startExpansion: function () {
		this.expanded = true;
		this.gameLevel.expandedBalls.push(this.number);
		this.gameLevel.totalBallsExpanded++;
后面还有 378 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。