import pygame
import globals

class Ball:
	
	def __init__(self, position):
		self.mass = 1.0
		self.radius = 13.0
		self.position = position
		self.velocity = 0, 0
		
		self.frames = []
		self.frames.append(pygame.image.load(globals.String_Pinball))
		
	def Update(self, ms):
		pos = [self.position[0] - self.radius, self.position[1] - self.radius]
		globals.UpdateRegions.append([pos[0], pos[1], 32, 32])
		timeseg = ms / globals.forcefactor
		
		newposx = self.position[0] + self.velocity[0]
		newposy =  self.position[1] + self.velocity[1]
		self.position = (newposx, newposy)
		
	def draw(self):
#        pygame.draw.circle(globals.screen, globals.white, self.position, int(self.radius), 2)
		pos = [self.position[0] - self.radius, self.position[1] - self.radius]
		globals.screen.blit(self.frames[0], pos)
		
	def Reset(self):
		pos = [self.position[0] - self.radius, self.position[1] - self.radius]
		globals.UpdateRegions.append([pos[0], pos[1], 32, 32])
		self.velocity = 0,0
		self.position = 380, 573
		
	def DrawBall(self, pos):
		globals.screen.blit(self.frames[0], pos)
		