<commit_before># everything to do with the cart

import pyglet
import settings
import entity

class Cart(entity.Entity):
    def __init__(self, *args, **kwargs):
        super(Cart, self).__init__(img = pyglet.resource.image(settings.CART_IMAGE), *args, **kwargs)
        self.velocity_x = settings.CART_NORMAL_VELOCITY
        self.on_track = False
        self.track_height = 0.0
        self.track_angle = 0.0

    def jump(self):
        if self.on_track:
            print "Jumping cart"
            self.velocity_y = settings.CART_JUMP_VELOCITY
            self.rotation = settings.CART_JUMP_ROTATION
    
    def update(self, dt, track_height, track_angle):
        super(Cart, self).update(dt)

        self.track_height = track_height
        self.track_angle = track_angle
        
        #print "on track: " + str(self.on_track)
        (gpx, gpy) = self.gp
        if gpy - self.image.height / 2.0 <= self.track_height + settings.TRACK_FUZZ:
            self.gp = (gpx, self.track_height + self.image.height / 2.0)
            self.velocity_y = 0.0
            self.rotation = -self.track_angle
            self.on_track = True 

        else:
            # we are off the track
            self.velocity_y += dt * settings.GRAVITY
            self.on_track = False<commit_msg>attached jump sound to jump<commit_after># everything to do with the cart

import pyglet
import settings
import entity
import sounds

class Cart(entity.Entity):
    def __init__(self, *args, **kwargs):
        super(Cart, self).__init__(img = pyglet.resource.image(settings.CART_IMAGE), *args, **kwargs)
        self.velocity_x = settings.CART_NORMAL_VELOCITY
        self.on_track = False
        self.track_height = 0.0
        self.track_angle = 0.0

    def jump(self):
        if self.on_track:
            print "Jumping cart"
            sounds.cart_jump.play()
            self.velocity_y = settings.CART_JUMP_VELOCITY
            self.rotation = settings.CART_JUMP_ROTATION

    def update(self, dt, track_height, track_angle):
        super(Cart, self).update(dt)

        self.track_height = track_height
        self.track_angle = track_angle

        #print "on track: " + str(self.on_track)
        (gpx, gpy) = self.gp
        if gpy - self.image.height / 2.0 <= self.track_height + settings.TRACK_FUZZ:
            self.gp = (gpx, self.track_height + self.image.height / 2.0)
            self.velocity_y = 0.0
            self.rotation = -self.track_angle
            self.on_track = True

        else:
            # we are off the track
            self.velocity_y += dt * settings.GRAVITY
            self.on_track = False
{'fraction_non_alphanumeric': 0.09730140630938806, 'fraction_numerical': 0.007601672367920942, 'mean_word_length': 2.144563918757467, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '854734', 'n_tokens_mistral': 859, 'n_tokens_neox': 829, 'n_words': 184}