<commit_before>"""
platformer.py
Author: <NAME>
Credit: Robbie
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer
        Platformer.listenKeyEvent("keydown", "s", self.SPRING)
        Platformer.listenKeyEvent("keyup", "s", self.SPRINGoff)
            
        Platformer.listenKeyEvent("keydown", "w", self.WALL)
        Platformer.listenKeyEvent("keyup", "w", self.WALLoff)
"""

from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 640

class Wall(Sprite):
    """
    THIS IS BOXY'S WALL
    """
    black = Color(0, 1)
    noline = LineStyle(0, black)
    asset = RectangleAsset(25, 25, noline, black)
    
    def __init__(self, position):
        super().__init__(Wall.asset, position)
        self.vx = 0
        self.vy = 0
        self.fxcenter = self.fycenter = 0.25

class Boxy(Sprite):
    """
    THIS IS BOXY
    """
    Black = Color(0, 1)
    oline = LineStyle(0, Black)
    blue = Color(0x0000ff, 1.0)
    asset = RectangleAsset(25, 50, oline, blue)
    
    def __init__(self, position):
        super().__init__(Boxy.asset, position)
        self.vx = 0
        self.vy = 5
        self.bricks = self.collidingWithSprites(Wall)
        self.fxcenter = self.fycenter = 0.25
        self.Matty = True
        Platformer.listenKeyEvent("keydown", "right arrow", self.moveright)
        Platformer.listenKeyEvent("keyup", "right arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "left arrow", self.moveleft)
        Platformer.listenKeyEvent("keyup", "left arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "up arrow", self.moveup)
        Platformer.listenKeyEvent("keyup", "up arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "right arrow", self.Falling)
        Platformer.listenKeyEvent("keydown", "left arrow", self.Falling)
        
        
    def step(self):
        self.vy = self.vy + 1 
        self.x += self.vx
        self.y += self.vy
        bricks =self.collidingWithSprites(Wall)
        if len(bricks) != 0:
            self.x -= self.vx
            self.y -= self.vy
            self.vx = self.vy = 0
            self.Matty = False
        else:
            self.Matty = True
            
    def Falling(self,event):
        if self.Matty == True:
            self.vy = self.vy + 1
    
    def moveoff(self,event):
            self.vx = 0
            self.vy = self.vy + 1
        
    def moveright(self, event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vx = 5
        else:
            self.vx = 0
            self.vy = 5
            
    def moveleft(self,event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vx = -5
        else:
            self.vx = 0
            self.vy = 5
            
    def moveup(self,event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vy = -20
        else:
            self.vy = 5
            
class Platformer(App):
    """
    THIS IS BOXY'S WORLD
    """
    def __init__(self, width, height):
        super().__init__(width, height)
        black = Color(1, 0)
        Black = Color(0, 1)
        Blue = Color(0x0000ff, 1.0)
        noline = LineStyle(5, Black)
        Noline = LineStyle(0, Black)
        bg_asset = RectangleAsset(width, height, noline, black)
        Platformer.listenKeyEvent("keydown", "w", self.Wall)
        Platformer.listenKeyEvent("keydown", "p", self.Boxy)
        Platformer.listenMouseEvent('mousemove', self.mousemove)
        self.Robbie = False
        bg = Sprite(bg_asset, (0,0))
        self.x = 0
        self.y = 0
        
    def step(self):<commit_msg>Updated from Brython Server: 11/9/2016 1:15:30 PM<commit_after>"""
platformer.py
Author: <NAME>
Credit: Robbie
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer
        Platformer.listenKeyEvent("keydown", "s", self.SPRING)
        Platformer.listenKeyEvent("keyup", "s", self.SPRINGoff)
            
        Platformer.listenKeyEvent("keydown", "w", self.WALL)
        Platformer.listenKeyEvent("keyup", "w", self.WALLoff)
"""

from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 640

class Wall(Sprite):
    """
    THIS IS BOXY'S WALL
    """
    black = Color(0, 1)
    noline = LineStyle(0, black)
    asset = RectangleAsset(25, 25, noline, black)
    
    def __init__(self, position):
        super().__init__(Wall.asset, position)
        self.vx = 0
        self.vy = 0
        self.fxcenter = self.fycenter = 0.25

class Boxy(Sprite):
    """
    THIS IS BOXY
    """
    Black = Color(0, 1)
    oline = LineStyle(0, Black)
    blue = Color(0x0000ff, 1.0)
    asset = RectangleAsset(25, 50, oline, blue)
    
    def __init__(self, position):
        super().__init__(Boxy.asset, position)
        self.vx = 0
        self.vy = 5
        self.bricks = self.collidingWithSprites(Wall)
        self.fxcenter = self.fycenter = 0.25
        self.Matty = True
        Platformer.listenKeyEvent("keydown", "right arrow", self.moveright)
        Platformer.listenKeyEvent("keyup", "right arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "left arrow", self.moveleft)
        Platformer.listenKeyEvent("keyup", "left arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "up arrow", self.moveup)
        Platformer.listenKeyEvent("keyup", "up arrow", self.moveoff)
        Platformer.listenKeyEvent("keydown", "right arrow", self.Falling)
        Platformer.listenKeyEvent("keydown", "left arrow", self.Falling)
        
        
    def step(self):
        self.vy = self.vy + 1
        self.y += self.vy
        bricks = self.collidingWithSprites(Wall)
        if len(bricks) != 0:
            self.y -= self.vy
            self.Matty = False
        else:
            self.Matty = True
        
        self.x += self.vx
        bricks = self.collidingWithSprites(Wall)
        if len(bricks) != 0:
            self.x -= self.vx
            self.vx = 0
            self.Matty = False
        else:
            self.Matty = True
            
    def Falling(self,event):
        if self.Matty == True:
            self.vy = self.vy + 1
    
    def moveoff(self,event):
            self.vx = 0
            self.vy = self.vy + 1
        
    def moveright(self, event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vx = 5
        else:
            self.vx = 5
            self.vy = 5
            
    def moveleft(self,event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vx = -5
        else:
            self.vx = -5
            self.vy = 5
            
    def moveup(self,event):
        if len(self.bricks) == 0:
            self.Matty = True
        if self.Matty == True:
            self.vy = -10000
        else:
            self.vy = 5
            
class Platformer(App):
    """
    THIS IS BOXY'S WORLD
    """
    def __init__(self, width, height):
        super().__init__(width, height)
        black = Color(1, 0)
        Black = Color(0, 1)
        Blue = Color(0x0000ff, 1.0)
        noline = LineStyle(5, Black)
        Noline = LineStyle(0, Black)
        bg_asset = RectangleAsset(width, height, noline, black)
        Platformer.listenKeyEvent("keydown", "w", self.Wall)
        Platformer.listenKeyEvent("keydown", "p", self.Boxy)
        Platformer.listenMouseEvent('mousemove', self.mousemove)
        self.Robbie = False
        bg = Sprite(bg_asset, (0,0))
        self.x = 0
        self.y = 0
        
    def step(self):
{'fraction_non_alphanumeric': 0.12131890259249938, 'fraction_numerical': 0.020135917442738484, 'mean_word_length': 1.9141914191419143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1621811', 'n_tokens_mistral': 2671, 'n_tokens_neox': 2543, 'n_words': 580}