<commit_before>/* globals __DEV__ */
import Phaser from 'phaser'
import Mushroom from '../sprites/Mushroom'

export default class extends Phaser.State {
    init() {
    }

    preload() {
        this.game.load.spritesheet('player', './assets/player.png', 28, 22);
        this.game.load.image('ground', './assets/ground.png');
        this.game.load.image('wall', './assets/wall.png');
        this.game.load.image('coin', './assets/coin.png');
        this.game.load.image('enemy','./assets/enemy.png');
        this.game.load.image('coin', 'assets/coin.png');
        this.game.load.image('dust', 'assets/dust.png');
        this.game.load.image('exp', 'assets/exp.png');

        this.game.load.audio('jump', ['./assets/jump.mp3', './assets/jump.wav']);
        this.game.load.audio('dust', ['assets/dust.wav', 'assets/dust.mp3']);
        this.game.load.audio('dead', ['assets/dead.wav', 'assets/dead.mp3']);
        this.game.load.audio('coin', ['assets/coin.wav', 'assets/coin.mp3']);
    }

    create() {
        this.game.physics.startSystem(Phaser.Physics.ARCADE)

        this.player = this.game.add.sprite(360, 100, 'player')
        this.loadLevel()

        this.jumpSound = this.game.add.audio('jump', 0.1)

        game.physics.arcade.enable(this.player)
        game.physics.arcade.enable(this.ground)
        game.physics.arcade.enable(this.wall1)
        game.physics.arcade.enable(this.wall2)
        this.player.body.gravity.y = 600

        this.player.body.setSize(20, 20, 0, 0);

        this.ground.body.immovable = true
        this.wall1.body.immovable = true
        this.wall2.body.immovable = true

        this.player.animations.add('idle', [3, 4, 5, 4], 5, true)
        this.player.animations.play('idle')

        this.cursor = game.input.keyboard.createCursorKeys()

        this.hasJumped = false
    }

    update() {
        this.game.physics.arcade.collide(this.player, this.ground)
        this.game.physics.arcade.collide(this.player, this.wall1)
        this.game.physics.arcade.collide(this.player, this.wall2)

        this.inputs()

        if (this.player.body.touching.down) {
            this.hasJumped = false
        }
    }

    loadLevel() {
        this.level = this.game.add.group()
        this.level.enableBody = true

        this.ground = this.game.add.sprite(760/2-160, 400/2-80, 0, 'wall', this.level)
        this.ground = this.game.add.sprite(760/2+140, 400/2-80, 0, 'wall', this.level)
        this.ground = this.game.add.sprite(760 / 2 - 160, 400 / 2, 0, 'ground', this.level)

    }

    putCoinsOnLevel() {
        this.coins = this.game.add.group();
        this.level.enableBody = true;

        this.ground = game.add.sprite(760/2-160,400/2,'ground',0, this.level);
        this.wall1 = game.add.sprite(760/2-160,500/2-80,'wall',0, this.level);
        this.wall2 = game.add.sprite(760/2+140,400/2-80,'wall',0, this.level);

        this.level.setAll('body.immovable', true);
    }

    inputs() {
      if (this.player.body) {
        if (this.cursor.left.isDown) {
          this.player.body.velocity.x = -200
          this.player.frame = 2<commit_msg>Resolve problems into loadLevel<commit_after>/* globals __DEV__ */
import Phaser from 'phaser'
import Mushroom from '../sprites/Mushroom'

export default class extends Phaser.State {
    init() {
    }

    preload() {
        this.game.load.spritesheet('player', './assets/player.png', 28, 22);
        this.game.load.image('ground', './assets/ground.png');
        this.game.load.image('wall', './assets/wall.png');
        this.game.load.image('coin', './assets/coin.png');
        this.game.load.image('enemy','./assets/enemy.png');
        this.game.load.image('coin', 'assets/coin.png');
        this.game.load.image('dust', 'assets/dust.png');
        this.game.load.image('exp', 'assets/exp.png');

        this.game.load.audio('jump', ['./assets/jump.mp3', './assets/jump.wav']);
        this.game.load.audio('dust', ['assets/dust.wav', 'assets/dust.mp3']);
        this.game.load.audio('dead', ['assets/dead.wav', 'assets/dead.mp3']);
        this.game.load.audio('coin', ['assets/coin.wav', 'assets/coin.mp3']);
    }

    create() {
        this.game.physics.startSystem(Phaser.Physics.ARCADE)

        this.player = this.game.add.sprite(360, 100, 'player')
        this.loadLevel()

        this.jumpSound = this.game.add.audio('jump', 0.1)

        game.physics.arcade.enable(this.player)
        game.physics.arcade.enable(this.ground)
        game.physics.arcade.enable(this.wall1)
        game.physics.arcade.enable(this.wall2)
        this.player.body.gravity.y = 600

        this.player.body.setSize(20, 20, 0, 0);

        this.ground.body.immovable = true
        this.wall1.body.immovable = true
        this.wall2.body.immovable = true

        this.player.animations.add('idle', [3, 4, 5, 4], 5, true)
        this.player.animations.play('idle')

        this.cursor = game.input.keyboard.createCursorKeys()

        this.hasJumped = false
    }

    update() {
        this.game.physics.arcade.collide(this.player, this.ground)
        this.game.physics.arcade.collide(this.player, this.wall1)
        this.game.physics.arcade.collide(this.player, this.wall2)

        this.inputs()

        if (this.player.body.touching.down) {
            this.hasJumped = false
        }
    }

    loadLevel() {
        this.level = this.game.add.group()
        this.level.enableBody = true

        this.ground = this.game.add.sprite(760/2-160, 400/2-80, 0, 'wall', this.level)
        this.ground = this.game.add.sprite(760/2+140, 400/2-80, 0, 'wall', this.level)
        this.ground = this.game.add.sprite(760/2-160, 400/2, 0, 'ground', this.level)

    }

    putCoinsOnLevel() {
        this.coins = this.game.add.group();
        this.level.enableBody = true;

        this.ground = game.add.sprite(760/2-160,400/2,'ground',0, this.level);
        this.wall1 = game.add.sprite(760/2-160,500/2-80,'wall',0, this.level);
        this.wall2 = game.add.sprite(760/2+140,400/2-80,'wall',0, this.level);

        this.level.setAll('body.immovable', true);
    }

    inputs() {
      if (this.player.body) {
        if (this.cursor.left.isDown) {
          this.player.body.velocity.x = -200
          this.player.frame = 2
{'fraction_non_alphanumeric': 0.1768837803320562, 'fraction_numerical': 0.038952745849297574, 'mean_word_length': 2.3975054229934925, 'pattern_counts': {'":': 0, '<': 3, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3782710', 'n_tokens_mistral': 2380, 'n_tokens_neox': 2173, 'n_words': 295}