I everyone! I'm having a little math trouble with a simple physics program I'm writing in python w/ pygame. If you notice in the code where it says: "((-ballSpeed[1]/4*3))", my ball on the screen just sits there and does nothing!! Whats wrong with my program?
import sys
import pygame
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
BLACK = (0, 0, 0)
ballSpeed = [0,4]
pygame.init()
screen = pygame.display.set_mode( (SCREEN_WIDTH,SCREEN_HEIGHT) )
ballImage = pygame.image.load( "box.bmp" )
ballRect = ballImage.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
pygame.display.set_caption("Testing! "+str(ballSpeed[0])+str(ballSpeed[1]))
ballRect = ballRect.move( ballSpeed )
if ballRect.left < 0 or ballRect.right > SCREEN_WIDTH:
ballSpeed[0] = -ballSpeed[0]
if ballRect.top < 0 or ballRect.bottom > SCREEN_HEIGHT:
ballSpeed[1] = ((-ballSpeed[1]/4*3))
screen.fill( BLACK )
screen.blit( ballImage, ballRect )
pygame.display.flip()