Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored code, added new Button class, reduced rerenders #25

Merged
merged 42 commits into from
Jun 25, 2023

Commits on Mar 29, 2023

  1. Configuration menu
    Copy the full SHA
    5becdbe View commit details
    Browse the repository at this point in the history
  2. Refactored code to employ D.R.Y principles and reduce CPU consumption

    created seperate functions for start and init to avoid rerendering the entire game screen every frame
    employed the usage of new Button class to reduce the hard coded functionalities for buttons in the main screen
    jriyyya committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    d189280 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ad46629 View commit details
    Browse the repository at this point in the history
  4. Refactored: Employed new Button class and made seperate functions for…

    … starting and running to avoid rendering the ui every frame
    jriyyya committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    4d6dc05 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2023

  1. autopep8 was run

    jriyyya committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    01be221 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2023

  1. Configuration menu
    Copy the full SHA
    17bdd8b View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2023

  1. Made button act when released instead of when pressed

    The button now has property press, which is turned true when button is pressed
    
    when button is released, the action is for the button is called
    jriyyya committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    30da576 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2e51d35 View commit details
    Browse the repository at this point in the history
  3. added not None check to score to avoid None type comparison

    Sometimes the Score was none and was compared to int maxscore
    
    This would cause TypeError and cause game to crash
    jriyyya committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    31af7c4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1f432cf View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dbef2b8 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    33fd5c7 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2023

  1. renamed variables

    - a was assigned in show_help and reassgined to self.running_mode
    - a has thus been eliminated 
     
    - s has been renamed to score_data for more clarity of its purpose
    jriyyya committed Apr 10, 2023
    Configuration menu
    Copy the full SHA
    15fcc1f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1d2f127 View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2023

  1. Configuration menu
    Copy the full SHA
    861d2c9 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2023

  1. Remove import not required

    quozl committed May 29, 2023
    Configuration menu
    Copy the full SHA
    9a31892 View commit details
    Browse the repository at this point in the history
  2. Deepen sugar3.activity.activity import

    Sugargame TestActivity does import Activity, inherit, and initialise,
    so follow the same pattern
    
    This results in a blank grey display.  Given that the only change is
    to imports, this suggests there is another problem that the unusual
    imports had hidden,
    quozl committed May 29, 2023
    Configuration menu
    Copy the full SHA
    825d3bd View commit details
    Browse the repository at this point in the history

Commits on May 30, 2023

  1. Run without Sugar

    Allows the application to be tested without Sugar.
    quozl committed May 30, 2023
    Configuration menu
    Copy the full SHA
    926b14e View commit details
    Browse the repository at this point in the history
  2. Use running not crashed

    An update to Sugargame changed practice so that we use running as a
    flag instead of crashed.
    quozl committed May 30, 2023
    Configuration menu
    Copy the full SHA
    791fa67 View commit details
    Browse the repository at this point in the history
  3. Change import order

    quozl committed May 30, 2023
    Configuration menu
    Copy the full SHA
    49856c0 View commit details
    Browse the repository at this point in the history
  4. Remove unused import

    quozl committed May 30, 2023
    Configuration menu
    Copy the full SHA
    a862cf1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bc1a550 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    325a137 View commit details
    Browse the repository at this point in the history
  7. Slow the main menu update rate

    quozl committed May 30, 2023
    Configuration menu
    Copy the full SHA
    f06c7b0 View commit details
    Browse the repository at this point in the history
  8. Centered Screen and Restructured code

    - Screen has been centered
    
    - vw and vh functions have been added to calculate
    relative co ords for screens
    
    - This allows support for multiple resolutions
    
    - restructured code wherever absolute values were used
    replaced them with new functions vw and vh
    
    - place_centered is added to blit things from their center
    as the origin instead of top left
    jriyyya committed May 30, 2023
    Configuration menu
    Copy the full SHA
    bd6792f View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2023

  1. Configuration menu
    Copy the full SHA
    ec491e0 View commit details
    Browse the repository at this point in the history
  2. Change object names for better understanding

    - place_centered change to blit_centre
    
    - screen_origin change to offse
    
    - visible_size change to bg_dimensions
    jriyyya committed Jun 1, 2023
    Configuration menu
    Copy the full SHA
    43a9dfb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    363793c View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2023

  1. Create class Spike in spike.py

    - This class acts as a generic spike and is used
      in Game to generate spikes as needed
    
    - The class contains logic to move the spike when updates
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    28d3052 View commit details
    Browse the repository at this point in the history
  2. Created generic Game and Generator class

    - Game class can be used to create a game with
      any configuration
    
    - This can be used to replace the hardcoded games
      like 2panewindow, 3panewindow etc
    
    - The class constructor takes in the background_image
      the key map for the controller and optional speed
      and optional border_width
    
    - Generator class is used in Game class to generate
      the spikes in game as defined by spikes_config
      defined for each game
    
    - It also handles the logic to delete the spikes
      when they have covered their allocated path
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    ab0e7e8 View commit details
    Browse the repository at this point in the history
  3. created Guy class in guy.py

    - the Guy class represents the falling guys
      which one may consider as the player characters
    
    - this class handles the logic for moving the
      guy left and right and also the collision checking
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    863a12b View commit details
    Browse the repository at this point in the history
  4. Updated main.py to use newer code structure

    - main.py now uses the Game class to defined each
      game mode instead of hardcoded imports
    
    - modified the run_game function declaration and
      its calls according to newer methods
    
    - keymaps for each call are hardcoded and defined
      in the button callback lambda functions for each
      game mode button
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    e6f2771 View commit details
    Browse the repository at this point in the history
  5. deleted hardcoded gamemodes

    - now that Game class replaces the hard coded
      game modes in main.py these can be deleted
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    830f254 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    91f19ff View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c88e15b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    95d47dd View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f096254 View commit details
    Browse the repository at this point in the history
  10. Declared BLACK and SPAWN_SPIKE_EVENT as constants

    Also Deleted white as it was not being used
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    5b117ff View commit details
    Browse the repository at this point in the history
  11. made keymap into list comprehension

    and also moved it closer to function for better readability
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    38346f0 View commit details
    Browse the repository at this point in the history
  12. Added license

    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    9b36885 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    ea573b0 View commit details
    Browse the repository at this point in the history
  14. optimise event handling

    - moved keymap iteration inside a conditional
      which checks for KEYDOWN events
    jriyyya committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    77ada49 View commit details
    Browse the repository at this point in the history