<commit_before>import Phaser from 'phaser'
import config from '../config'
import { makeGreen, centerGameObjects, isTouchDevice } from '../utils'

export default class extends Phaser.State {
	create () {
		this.map = this.game.add.tilemap('liip')
		this.map.addTilesetImage('tiles_spritesheet', 'gameTiles')

		// create layers
		this.backgroundLayer = this.map.createLayer('backgroundLayer')
		this.blockedLayer = this.map.createLayer('blockedLayer')
		this.map.setCollisionBetween(1, 100000, true, 'blockedLayer')
		this.backgroundLayer.resizeWorld()

		let banner = this.game.add.image(
			this.game.width / 2,
			80,
			'startLogo')
		banner.scale.setTo(0.25, 0.25)

		// start button
		let start = this.game.add.image(
			this.game.width / 2,
			140,
			'start')
		start.scale.setTo(0.8)
		centerGameObjects([banner, start])

		// setup player
		this.player = this.game.add.sprite(100, 200, 'player')
		this.game.physics.arcade.enable(this.player)
		this.player.body.gravity.y = config.player.weight

		// show hint
		let howToJump = isTouchDevice()
			? 'Tap your screen'
			: 'Press space'
		let intro = this.game.add.text(
			0,
			170,
			`${howToJump} to jump`,
			Object.assign(config.text.md, ({ boundsAlignH: "center" })))
		intro.setTextBounds(0, 30, this.game.width, 30);

		// init keys
		this.keys = this.game.input.keyboard.addKeys({
			space: Phaser.KeyCode.SPACEBAR,
		})

		this.player.standDimensions = {width: this.player.width, height: this.player.height}
		this.player.anchor.setTo(0.5, 1)
		start.inputEnabled = true
		start.events.onInputDown.add(() => {
			this.game.state.start('Game')
		})
	}

	update () {
		this.game.physics.arcade.collide(this.player, this.blockedLayer, this.playerHit, null, this)
		if (this.keys.space.isDown) {
			this.state.start('Game')
		}
	}
}<commit_msg>allow spacebar or tap to start game on intro screen<commit_after>import Phaser from 'phaser'
import config from '../config'
import { makeGreen, centerGameObjects, isTouchDevice } from '../utils'
import Input from '../Input'

export default class extends Phaser.State {
	create () {
		this.map = this.game.add.tilemap('liip')
		this.map.addTilesetImage('tiles_spritesheet', 'gameTiles')

		// create layers
		this.backgroundLayer = this.map.createLayer('backgroundLayer')
		this.blockedLayer = this.map.createLayer('blockedLayer')
		this.map.setCollisionBetween(1, 100000, true, 'blockedLayer')
		this.backgroundLayer.resizeWorld()

		let banner = this.game.add.image(
			this.game.width / 2,
			80,
			'startLogo')
		banner.scale.setTo(0.25, 0.25)

		// start button
		let start = this.game.add.image(
			this.game.width / 2,
			140,
			'start')
		start.scale.setTo(0.8)
		centerGameObjects([banner, start])

		// setup player
		this.player = this.game.add.sprite(100, 200, 'player')
		this.game.physics.arcade.enable(this.player)
		this.player.body.gravity.y = config.player.weight

		// show hint
		let howToJump = isTouchDevice()
			? 'Tap your screen'
			: 'Press space'
		let intro = this.game.add.text(
			0,
			170,
			`${howToJump} to jump`,
			Object.assign(config.text.md, ({ boundsAlignH: "center" })))
		intro.setTextBounds(0, 30, this.game.width, 30);

		// init input (keyboard or tap on mobile)
		this.input = new Input({ game: this.game })

		this.player.standDimensions = {width: this.player.width, height: this.player.height}
		this.player.anchor.setTo(0.5, 1)
		start.inputEnabled = true
		start.events.onInputDown.add(() => {
			this.game.state.start('Game')
		})
	}

	update () {
		this.game.physics.arcade.collide(this.player, this.blockedLayer, this.playerHit, null, this)
		if (this.input.shouldJump()) {
			this.state.start('Game')
		}
	}
}
{'fraction_non_alphanumeric': 0.15233949945593037, 'fraction_numerical': 0.02176278563656148, 'mean_word_length': 3.666243654822335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1506284', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1305, 'n_words': 251}