<commit_before>// var music = new buzz.sound("/audio/background", {
// 	formats: [ "mp3", "ogg" ],
// 	preload: true,
// 	autoplay: false,
// 	loop: true
// });
// var musicTime = 4.55;

var levels = [
	[new Music('jungle'), null],
	[new Music('dub'), Transition]
];

function Game(canvas) {
	this.ext_canvas = canvas
	this.ext_ctx = canvas.getContext("2d")

	this.canvas = document.createElement('canvas');
	this.canvas.width = GAME_WIDTH;
	this.canvas.height = GAME_HEIGHT;
	this.ctx = this.canvas.getContext('2d');

	this.objects = []
	this.prevTime = Date.now()
	this.speed = 4
	this.paused = false
	this.play = true
	this.timeTillLevel = 10000
	this.timer = 0

	this.spawning = true;
	this.transition = null;

	this.nextLevel = function() {
		this.setLevel(this.level + 1);
	};

	this.setLevel = function(num) {
		var level = levels[num];
		var music = level[0];
		var transition = level[1];
		this.level = num;

		// music.play();
		this.objects['player'].setMusic(music);
		if (transition) {
			this.transition = new transition(this);
		}
	};
	
	this.update = function(time) {
		if (!this.play) {
			this.objects['player'].music.pause();
			return;
		}

		this.objects['player'].syncTracks();
		if (this.objects['player'].music.tracks[0].getRemainingTime() < 4) {
			this.spawning = false;
		}

		this.timeDelta = time - this.prevTime
		this.prevTime = time
		if (isNaN(this.timeDelta)) {
			requestAnimFrame(this.update.bind(this))
			return
		}
		this.physics(this.timeDelta)
		this.draw()

		requestAnimFrame(this.update.bind(this));
	}

	this.physics = function(timeDelta) {
		for (var i = 0; i < this.objects.length; i++) {
			this.objects[i].physics(timeDelta)
		}

		if (this.transition) {<commit_msg>it works better somehow now<commit_after>// var music = new buzz.sound("/audio/background", {
// 	formats: [ "mp3", "ogg" ],
// 	preload: true,
// 	autoplay: false,
// 	loop: true
// });
// var musicTime = 4.55;

var levels = [
	[new Music('jungle'), null],
	[new Music('dub'), Transition]
];

function Game(canvas) {
	this.ext_canvas = canvas
	this.ext_ctx = canvas.getContext("2d")

	this.canvas = document.createElement('canvas');
	this.canvas.width = GAME_WIDTH;
	this.canvas.height = GAME_HEIGHT;
	this.ctx = this.canvas.getContext('2d');

	this.objects = []
	this.prevTime = Date.now()
	this.speed = 4
	this.paused = false
	this.play = true
	this.timeTillLevel = 10000
	this.timer = 0

	this.spawning = true;
	this.transition = null;

	this.nextLevel = function() {
		this.setLevel(this.level + 1);
	};

	this.setLevel = function(num) {
		var level = levels[num];
		var music = level[0];
		var transition = level[1];
		this.level = num;

		// music.play();
		this.objects['player'].setMusic(music);
		if (transition) {
			this.transition = new transition(this);
		}
	};
	
	this.update = function(time) {
		if (!this.play) {
			this.objects['player'].music.pause();
			return;
		}

		this.objects['player'].syncTracks();
		if (this.objects['player'].music.tracks[0].getRemainingTime() < 8) {
			this.spawning = false;
		}

		this.timeDelta = time - this.prevTime
		this.prevTime = time
		if (isNaN(this.timeDelta)) {
			requestAnimFrame(this.update.bind(this))
			return
		}
		this.physics(this.timeDelta)
		this.draw()

		requestAnimFrame(this.update.bind(this));
	}

	this.physics = function(timeDelta) {
		for (var i = 0; i < this.objects.length; i++) {
			this.objects[i].physics(timeDelta)
		}

		if (this.transition) {
{'fraction_non_alphanumeric': 0.17305458768873402, 'fraction_numerical': 0.011033681765389082, 'mean_word_length': 3.5508586525759576, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2310313', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1248, 'n_words': 236}