<commit_before>import { CursorKeys, Game, Point, Sprite } from 'phaser-ce'
import gameStore from '../../stores/gameStore'
import { linearMap } from '../../utils'
import PlayerEvents from '../classes/PlayerEvents'
import InteractionHint from './InteractionHint'

export default class Player extends Sprite {
    interactionHint: InteractionHint
    events: PlayerEvents

    constructor(game: Game, x: number, y: number) {
        super(game, x, y, 'player')
        this.events = new PlayerEvents(this)

        this.anchor.setTo(0.5)

        this.game.physics.enable(this)
        this.body.collideWorldBounds = true

        this.animations.add('down', [0, 1, 2, 3], 10, true)
        this.animations.add('left', [4, 5, 6, 7], 10, true)
        this.animations.add('right', [8, 9, 10, 11], 10, true)
        this.animations.add('up', [12, 13, 14, 15], 10, true)

        this.body.offset = new Point(0, 34)
        this.body.width = 30
        this.body.height = 13

        this.frame = 1

        this.interactionHint = game.add.existing(
            new InteractionHint(game, 25, 0)
        )
        this.addChild(this.interactionHint)

        this.events.onMoveBottomDown.add((velocity = 1) => {
            this.body.velocity.y = linearMap(0, 1, 0, 250, velocity)
            this.animations.play('down')
        })

        this.events.onMoveBottomUp.add(() => {
            this.body.velocity.y = 0
            this.animations.stop('down')
        })

        this.events.onMoveTopDown.add((velocity = 1) => {
            this.body.velocity.y = -linearMap(0, 1, 0, 250, velocity)
            this.animations.play('up')
        })

        this.events.onMoveTopUp.add(() => {
            this.body.velocity.y = 0
            this.animations.stop('up')
        })

        this.events.onMoveRightDown.add((velocity = 1) => {
            this.body.velocity.x = linearMap(0, 1, 0, 250, velocity)
            this.animations.play('right')
        })

        this.events.onMoveRightUp.add(() => {
            this.body.velocity.x = 0
            this.animations.stop('right')
        })

        this.events.onMoveLeftDown.add((velocity = 1) => {
            this.body.velocity.x = -linearMap(0, 1, 0, 250, velocity)
            this.animations.play('left')
        })

        this.events.onMoveLeftUp.add((velocity: number) => {
            this.body.velocity.x = 0
            this.animations.stop('left')
        })

        this.events.onStopMoving.add(this.stopMoving)
    }

    stopMoving = () => {<commit_msg>Setting the right frame on animation stop<commit_after>import { CursorKeys, Game, Point, Sprite } from 'phaser-ce'
import gameStore from '../../stores/gameStore'
import { linearMap } from '../../utils'
import PlayerEvents from '../classes/PlayerEvents'
import InteractionHint from './InteractionHint'

export default class Player extends Sprite {
    interactionHint: InteractionHint
    events: PlayerEvents

    constructor(game: Game, x: number, y: number) {
        super(game, x, y, 'player')
        this.events = new PlayerEvents(this)

        this.anchor.setTo(0.5)

        this.game.physics.enable(this)
        this.body.collideWorldBounds = true

        this.animations.add('down', [0, 1, 2, 3], 10, true)
        this.animations.add('left', [4, 5, 6, 7], 10, true)
        this.animations.add('right', [8, 9, 10, 11], 10, true)
        this.animations.add('up', [12, 13, 14, 15], 10, true)

        this.body.offset = new Point(0, 34)
        this.body.width = 30
        this.body.height = 13

        this.frame = 1

        this.interactionHint = game.add.existing(
            new InteractionHint(game, 25, 0)
        )
        this.addChild(this.interactionHint)

        this.events.onMoveBottomDown.add((velocity = 1) => {
            this.body.velocity.y = linearMap(0, 1, 0, 250, velocity)
            this.animations.play('down')
        })

        this.events.onMoveBottomUp.add(() => {
            this.body.velocity.y = 0
            this.animations.stop('down')
            this.frame = 0
        })

        this.events.onMoveTopDown.add((velocity = 1) => {
            this.body.velocity.y = -linearMap(0, 1, 0, 250, velocity)
            this.animations.play('up')
        })

        this.events.onMoveTopUp.add(() => {
            this.body.velocity.y = 0
            this.animations.stop('up')
            this.frame = 12
        })

        this.events.onMoveRightDown.add((velocity = 1) => {
            this.body.velocity.x = linearMap(0, 1, 0, 250, velocity)
            this.animations.play('right')
        })

        this.events.onMoveRightUp.add(() => {
            this.body.velocity.x = 0
            this.animations.stop('right')
            this.frame = 8
        })

        this.events.onMoveLeftDown.add((velocity = 1) => {
            this.body.velocity.x = -linearMap(0, 1, 0, 250, velocity)
            this.animations.play('left')
        })

        this.events.onMoveLeftUp.add((velocity: number) => {
            this.body.velocity.x = 0
            this.animations.stop('left')
            this.frame = 4
        })

        this.events.onStopMoving.add(this.stopMoving)
    }

    stopMoving = () => {
{'fraction_non_alphanumeric': 0.14459224985540775, 'fraction_numerical': 0.029882398303450936, 'mean_word_length': 2.0005783689994217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3282263', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1580, 'n_words': 314}