<commit_before>/// <reference path="../../dist/piston-0.4.0.d.ts" />

namespace SampleGame {
    export class SpriteBall extends ps.EntityWithSprites {
        initialPos: ps.Point;
        constructor() {
            super(new ps.Point(100, 100));
            this.vel = new ps.Vector(10, 0);
            this.radius = 10;
            this.rotationSpeed = -1;
            this.initialPos = this.pos;
            
            let ballSprite = new ps.Sprite(new ps.Point(0, 0), [10, 10], [0, 1, 2,], 0.9, "assets/ball.png");
            this.sprites.push(ballSprite);
        }

        render(camera: ps.Camera) {
            camera.drawLine(this.initialPos, this.pos, 3, "green");
            camera.paintSprites(this.pos, this.rotation, [30, 80], this.sprites);
        }
    }
}
<commit_msg>extend sample game to use keyboard. Resolves #9<commit_after>/// <reference path="../../dist/piston-0.4.0.d.ts" />

namespace SampleGame {
    export class SpriteBall extends ps.EntityWithSprites {
        initialPos: ps.Point;
        constructor() {
            super(new ps.Point(100, 100));
            this.vel = new ps.Vector(10, 0);
            this.radius = 10;
            this.rotationSpeed = -1;
            this.initialPos = this.pos;
            
            let ballSprite = new ps.Sprite(new ps.Point(0, 0), [10, 10], [0, 1, 2,], 0.9, "assets/ball.png");
            this.sprites.push(ballSprite);
        }

        update(dt: number, dims: ps.Vector) {
            super.update(dt, dims);
            if (this.engine.keyboard.isKeyDown("space")) {
                this.pos.x += 20;
            }
        }

        render(camera: ps.Camera) {
            camera.drawLine(this.initialPos, this.pos, 3, "green");
            camera.paintSprites(this.pos, this.rotation, [30, 80], this.sprites);
        }
    }
}

{'fraction_non_alphanumeric': 0.1509330406147091, 'fraction_numerical': 0.03567508232711306, 'mean_word_length': 1.7874617737003058, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7357969', 'n_tokens_mistral': 626, 'n_tokens_neox': 577, 'n_words': 119}