StartPy Game Object Library
For this project I was asked to maintain a pygame library for a fun, introductory class to game programming. The objective of the StartPy library is to create an easy to use interface for first time programmers to create simple games such as pong. I was responsible for developing, maintaining, and testing compound objects (multiple objects being added together as one object), labels, buttons, backgrounds and more, mostly dealing with the GObj.py file.
An example of a basic demonstration using various game objects is shown below. The code is basic and straight-forward to read, as intended by the StaryPy library. A video is also shown of the script being run.
Example Code
from StartPy import *
start()
run = True
cir = Circle(100, BLUE)
img = Image('img.jpg', 350, 0)
btn = Button('Click to start', 50, GRAY, BLACK, 135, 250)
lab = Label(50, BLACK, 'Demo is running...', 20, 20)
add(cir)
add(img)
add(btn)
add(lab)
sendToBack(lab)
waitForClick()
remove(btn)
while run:
cir.move(1, 1)
img.move(-1, 1)
pause(2)
if collides(cir, img):
comp = img + cir
add(comp)
img.setVisible(False)
while run:
comp.move(0, 1)
pause(2)
if comp.getY() > 400:
run = False
lab.setText('Demo is completed!')
stop()
Running the Example Code
Check out the GitHub repository
Written on April 23, 2018
