<commit_before>import Phaser from 'phaser'
import Ship from '../sprites/Ship'
import Asteroid from '../sprites/Asteroid'
import Robot from '../sprites/Robot'
import Planet, { planets } from '../sprites/Planet'
import BlackHole from '../sprites/BlackHole'
import Coin from '../sprites/Coin'
import Sun from '../sprites/Sun'
import Flag from '../sprites/Flag'
import Arrow from '../sprites/Arrow'

const FlagPoints = 250;
const RobotPoints = 50;
const CoinPoints = 50;
const AsteroidPoints = 25;
const HealthPoints = 10;
const FuelPoints = 10;

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

    create () {
        //Setup physics
        game.physics.startSystem(Phaser.Physics.ARCADE);

        // Set up game input.
        game.cursors = game.input.keyboard.createCursorKeys()
        game.input.keyboard.addKeyCapture([ Phaser.Keyboard.SPACEBAR ])

        //Setup the world
        var worldWidth = 4096;
        var worldHeight = 4096;
        this.background = new Phaser.TileSprite(game, 0, 0, worldWidth, worldHeight, 'background')

        //Setup the player
        this.world.setBounds(0,0,worldWidth,worldHeight);
        this.player = new Ship({
            game: this,
            x: this.world.centerX,
            y: this.world.centerY,
            asset: 'ship'
        })
        this.player.body.collideWorldBounds = true;
        game.camera.follow(this.player);

        //Populate world with objects
        this.game.add.existing(this.background)
        this.asteroids = game.add.physicsGroup();
        this.robots = game.add.physicsGroup();
        this.coins = game.add.physicsGroup();
        this.addBlackHoles()
        this.addPlanets()
        this.flags = game.add.physicsGroup();
        this.addSun()
        this.game.add.existing(this.player);

        //Starting flag
        var sun = this.game.suns[0];
        var flag = this.addFlag(sun);

        //Arrow to flag
        this.addArrow(flag);

        //Load high score
        var highScore = 0;
        var loadScore = localStorage.getItem("killerRobotsHighScore");
        if (loadScore !== null) {
            highScore = parseInt(loadScore);
        }
        this.HighScore = highScore;

        //Add HUD info
        this.fuelText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var fuelTextImage = game.add.image(362, 35, this.fuelText)
        fuelTextImage.tint = 0xFF7766
        fuelTextImage.fixedToCamera = true

        //health text
        this.healthText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var healthTextImage = game.add.image(362, 5, this.healthText)
        healthTextImage.tint = 0x28bb35
        healthTextImage.fixedToCamera = true

        //score text
        this.scoreText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var scoreTextImage = game.add.image(5, 5, this.scoreText)
        scoreTextImage.tint = 0xFFD700
        scoreTextImage.fixedToCamera = true

        //high score text
        this.highScoreText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var highScoreTextImage = game.add.image(5, 35, this.highScoreText)

        scoreTextImage.tint = 0xFFD700
        scoreTextImage.fixedToCamera = true

        //game over text
        this.gameOverText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var gameOverTextImage = game.add.image(game.camera.width/8, game.camera.height/2, this.gameOverText)
        gameOverTextImage.tint = 0xD80000
        gameOverTextImage.fixedToCamera = true


        highScoreTextImage.tint = 0xFF9905
        highScoreTextImage.fixedToCamera = true


        // Set up a weapon
        this.weapon = game.add.weapon(50, 'bullet')
        this.weapon.bulletLifespan = 1000;
        this.weapon.bulletKillType = Phaser.Weapon.KILL_LIFESPAN;

            this.weapon.bulletSpeed = 1200
        this.weapon.fireRate = 100;
        this.weapon.trackSprite(this.player, 0, 0, true);
        var shootSignal = new Phaser.Signal();
        shootSignal.add(function() {
            this.laser1.play();
        }, this);
        this.weapon.onFire = shootSignal;

        this.robotWeaponGroup = this.game.add.physicsGroup();<commit_msg>Add pause/options menu<commit_after>import Phaser from 'phaser'
import Ship from '../sprites/Ship'
import Asteroid from '../sprites/Asteroid'
import Robot from '../sprites/Robot'
import Planet, { planets } from '../sprites/Planet'
import BlackHole from '../sprites/BlackHole'
import Coin from '../sprites/Coin'
import Sun from '../sprites/Sun'
import Flag from '../sprites/Flag'
import Arrow from '../sprites/Arrow'

const FlagPoints = 250;
const RobotPoints = 50;
const CoinPoints = 50;
const AsteroidPoints = 25;
const HealthPoints = 10;
const FuelPoints = 10;

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

    create () {
        //Setup physics
        game.physics.startSystem(Phaser.Physics.ARCADE);

        // Set up game input.
        game.cursors = game.input.keyboard.createCursorKeys()
        game.input.keyboard.addKeyCapture([ Phaser.Keyboard.SPACEBAR ])

        //Setup the world
        var worldWidth = 4096;
        var worldHeight = 4096;
        this.background = game.add.tileSprite(0, 0, worldWidth, worldHeight, 'background')

        //Setup the player
        this.world.setBounds(0,0,worldWidth,worldHeight);
        this.player = new Ship({
            game: this,
            x: this.world.centerX,
            y: this.world.centerY,
            asset: 'ship'
        })
        this.player.body.collideWorldBounds = true;
        game.camera.follow(this.player);

        //Populate world with objects
        this.asteroids = game.add.physicsGroup();
        this.robots = game.add.physicsGroup();
        this.coins = game.add.physicsGroup();
        this.addBlackHoles()
        this.addPlanets()
        this.flags = game.add.physicsGroup();
        this.addSun()
        this.game.add.existing(this.player);

        //Starting flag
        var sun = this.game.suns[0];
        var flag = this.addFlag(sun);

        //Arrow to flag
        this.addArrow(flag);

        //Load high score
        var highScore = 0;
        var loadScore = localStorage.getItem("killerRobotsHighScore");
        if (loadScore !== null) {
            highScore = parseInt(loadScore);
        }
        this.HighScore = highScore;

        //Add HUD info
        this.fuelText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var fuelTextImage = game.add.image(362, 35, this.fuelText)
        fuelTextImage.tint = 0xFF7766
        fuelTextImage.fixedToCamera = true

        //health text
        this.healthText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var healthTextImage = game.add.image(362, 5, this.healthText)
        healthTextImage.tint = 0x28bb35
        healthTextImage.fixedToCamera = true

        //score text
        this.scoreText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var scoreTextImage = game.add.image(5, 5, this.scoreText)
        scoreTextImage.tint = 0xFFD700
        scoreTextImage.fixedToCamera = true

        //high score text
        this.highScoreText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var highScoreTextImage = game.add.image(5, 35, this.highScoreText)

        scoreTextImage.tint = 0xFFD700
        scoreTextImage.fixedToCamera = true

        // options/pause menu text
        this.optionsText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        // this.optionsText.text = 'options'
        this.optionsText.text = 'pause'
        var optionsTextImage = game.add.image(5, 362, this.optionsText)
        optionsTextImage.tint = 0xFFFFFF
        optionsTextImage.fixedToCamera = true
        optionsTextImage.inputEnabled = true
        optionsTextImage.events.onInputDown.add(() => {
          game.paused = !game.paused
        })

        //game over text
        this.gameOverText = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET2, 10, 1, 0)
        var gameOverTextImage = game.add.image(game.camera.width/8, game.camera.height/2, this.gameOverText)
        gameOverTextImage.tint = 0xD80000
        gameOverTextImage.fixedToCamera = true


        highScoreTextImage.tint = 0xFF9905
        highScoreTextImage.fixedToCamera = true


        // Set up a weapon
        this.weapon = game.add.weapon(50, 'bullet')
        this.weapon.bulletLifespan = 1000;
        this.weapon.bulletKillType = Phaser.Weapon.KILL_LIFESPAN;

            this.weapon.bulletSpeed = 1200
        this.weapon.fireRate = 100;
        this.weapon.trackSprite(this.player, 0, 0, true);
        var shootSignal = new Phaser.Signal();
        shootSignal.add(function() {
            this.laser1.play();
        }, this);
        this.weapon.onFire = shootSignal;

        this.robotWeaponGroup = this.game.add.physicsGroup();
{'fraction_non_alphanumeric': 0.11413339136111414, 'fraction_numerical': 0.030464584920030464, 'mean_word_length': 2.4044444444444446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2052414', 'n_tokens_mistral': 3133, 'n_tokens_neox': 2846, 'n_words': 607}