Coder Social home page Coder Social logo

andygett / breakoutxp-pygame Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 5.95 MB

Tracks XP for the current user's game level, game, session and career, persisting these values to the database.

License: MIT License

Python 100.00%
2d-game database game game-development games pygame pygame-application pygame-game pygame-games pygame-menu python sqlite sqlite-database sqlite3 sqlite3-database

breakoutxp-pygame's Introduction

BreakoutXP-pygame

A fun project to ramp up on Python and sqlite.

BreakoutXP is based on the classic breakout game in which the user moves a paddle to bounce balls up to a wall to hit and destroy the bricks. BreakoutXP tracks eXperience Points for the current user's game level, game, session and career, persisting these values to the database. When a ball hits something, you get more XP. Acquiring powerups increments XP. Clear most (90%) of the blocks to advance to the next level which grants XP. Each level renders with different colors using a fade-in pattern picked at random.

Demo with powerups, level transition

Powerups

  1. Wider paddle (really paddle width change. It can get smaller!)
  2. Multiball 3-5 balls
  3. Extra life
  4. SloMo
  5. Fire ball - the ball destroys the brick, but does not bounce
  6. Invinciballs - all balls bounce back up even if the paddle misses
  7. Big ball
  8. Highball - Balls only interact with bricks on their way down.

Beware powerups with a red number.

Keyboard commands during play

  1. Left & right arrows move paddle
  2. Enter shows stats
  3. Esc quits to menu or command prompt depending on start method
  4. U and D jump up or down a level - fun for viewing different transitions

Requirements

  • python3 which includes sqlite3
  • pygame:
    • Windows install: py -m pip install -U pygame --user
    • Mac install: python3 -m pip install -U pygame --user

Optional

pygame-pymenu

To run from command prompt

  1. Without menu, just play the game: breakout.py
  2. Use menu which allows creating and changing users: breakomenu.py This "just plays the game" if pygame-menu is not available.

breakoutxp-pygame's People

Contributors

andygett avatar

Stargazers

 avatar

Watchers

 avatar

breakoutxp-pygame's Issues

Powerup upgrdes

Spawning
Make list of spawn rates for deciding which powerup to spawn
Show list in stats
Create powerup at on ball hit instead of Wall render
Types
Fireball - Ball does not bounce when it hits a brick
Bigball
invinciballs - Ball bounces at bottom of screen
widerPaddle can be smaller paddle
highball - No brick collisions going up, only down.
Show powerup value as it falls, green for upgrade, red for pain

New level after clear a level

		Make levelThreshhold determine what percent of bricks need to be hit to clear level
		Show level number in corner
		When levelThreshhold is cleared, wait 1 second for newLevel()
			New wall
		Use levelThreshhold  to calculate progress bar instead of totalBricks

Use Database for Events, etc.

Users
Games
Levels
Events
-Zulu timestamps
-Make entry for new game, end game,
-DB table of events for easy tracking
-Cache game events. Update db after game over
Show events stats

SlowMo Powerup

add waitlist member to Ball class
varying speed delta, but always speed > 0.7

make restartDb() an option in menu

Pick a good menu label - Remove all user data
On menu select, show appropriate warning, like

BE CAREFUL WITH THIS. All users and user XP will be deleted, leaving Guest with no XP. Consider making a copy of BreakO.db if it is not too large already.

Make the user type "restart" or something instead of a possibly blind click.

Menu

Use pygame-pymenu
users
config table

Powerup images

Images
Hookup
Resize
Dead when bottom of pu is below paddle bottom + ball.size top of pu is below paddle bottom
Slow it
Shrink as percentage from death when top dips below screen bottom where it should be ball size?
Adjust powerup rates

Track events, other Level data in db

Level number
foreign key references idGame
PauseDuration accumulated for the level for inferring actual play time.
Events table references idLevel - ALTER table events add column idLevel
backward compatibility for existing Games recrods
For each game -
Insert into level, levelNum=1, pause = 0, maxBalls=1, idGame which is Level.Row Id
Update events table idLevel = new idLevel where idGame = this idGame
https://stackoverflow.com/questions/10921172/correct-sqlite-syntax-update-select-with-where-exists
Update events set idLevel = idGame

Refactor breakout.py for better readability.

powerups.py - static spawning class, abstract parent class plus 8 powerups
gamestpries.py - Wall, Brick, Ball, Paddle
Utils - Waitlist, Events
Use module variable for game instead of global

Refactor waitList options

		def game.delay(waitDuration, action) to wrap game.waitList.append([…
		Class WaitList :
			Items[]
			Process()

add() - or post() to be consistent with pygame.event

Hot key toggle to freeze game without seeing stats - just stop all balls, pups.

Pick toggle event - space bar? f key?
something like (this is kind of old)...
def function getRunModeFromUserInput(self, runMode)
if K_f, return "f"
if runMode = f, show text Press f tounfreeze
else:
self.showUserLevelOnClearScreen()
On resume, extend powerups by pauseDuration like rmPAUSE
But create rmFREEZE= 2**3 or something instead of "f"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.