Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Board.py
- '''
- Created on Nov 6, 2012
- @author: pipsqueaker
- '''
- import pygame, sys
- #import redSquare
- import physicsEngine
- import time
- rectCalc = physicsEngine.rectangleDeity
- GREEN = (0, 255, 0)
- RED = (255, 0, 0)
- BLUE = (0, 0, 255)
- BLACK = (0, 0, 0)
- WHITE = (255, 255, 255)
- BOARDWIDTH = 800
- BOARDHEIGHT = 600
- DESIRED_FPS = 60
- fpsClock = pygame.time.Clock()
- testBox = rectCalc(BOARDWIDTH, BOARDHEIGHT, .95, .5, 1, 50, 50) #.95 gave perfectly modeled bouncing
- testBox2 = rectCalc(BOARDWIDTH, BOARDHEIGHT, .95, .5, 1, 100, 50)
- pygame.init()
- displaysurf = pygame.display.set_mode((BOARDWIDTH, BOARDHEIGHT))
- while True: # main game loop
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- sys.exit()
- if event.type == pygame.KEYDOWN :
- if event.key == pygame.K_RIGHT:
- testBox.pushX(12)
- elif event.key == pygame.K_LEFT:
- testBox.pushSpecialX(12)
- elif event.key == pygame.K_UP:
- testBox.jump(20)
- displaysurf.fill(BLACK)
- pygame.draw.rect(displaysurf, RED, testBox.returnMyRectangle())
- pygame.draw.rect(displaysurf, BLUE, testBox2.returnMyRectangle())
- testBox.gravityAct()
- testBox2.gravityAct()
- testBox.AirResistanceSlow(testBox.dx, testBox.dy) #Keep this last. It's where' the move method is fially called. Bundle em sometime, maybe
- testBox2.AirResistanceSlow(testBox2.dx, testBox2.dy)
- pygame.display.update()
- fpsClock.tick(DESIRED_FPS)
- #pygame.sprite.collide_rect(left, right):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement