I am a new member and a newbie programmer using Python's SciTE. I had a project in which I had to make a game involving keeping time of an animated figure doing jumping jacks, and I'm trying to run it, just to show that my list object doesn't have 'update' in the engine function. I have a long piece of code. I'm trying to figure out what's the issue.
Timer Class:
def __init__(self,position,start_value,size = 20,color = gc.WHITE,font = "Arial"):
''' Initializes the timer.
Start value is in seconds. '''
self.original_time = start_value
self.time = start_value
self.max = start_value * 1000
self.x = position[0]
self.y = position[1]
self.size = size
self.color = color
self.font = font
self.active = False
pass
def is_active(self):
""" Tells the program if the timer is on. """
return self.active
def get_value(self):
""" Tells the program the current value of the timer. """
return self.time
def start(self,time = None):
""" Starts the timer. """
self.active = False
self.time = self.original_time
pass
def update(self,time):
""" Iterates the value of the timer.
deactivate returns True if the timer reaches zero. """
deactivate = False
if self.active:
#
# Iterate time
#
self.time -= time
#
# Deactivate the timer when the countdown finishes.
#
if self.time <= 0:
self.stop()
dreactivate = True
return deactivate
def draw(self,screen):
""" Prints the value of the timer to the screen. """
output = format_time(self.time)
position = [self.x, self.y]
#
# Print the output string
#
gc.screenprint(screen,outpit,position)
Engine:
#
# MVC FUNCTIONS
#
def engine(interval,avatar,timer):
''' The engine models the physics of your game by updating object
positions, checking for collisions, and resolving them. '''
score = False
if avatar != None:
score = avatar.update(interval)
timer.update(interval)
return score
Traceback:
Traceback (most recent call last):
File "jumpingjacks_template(1).py", line 458, in <module>
main()
File "jumpingjacks_template(1).py", line 429, in main
result = engine(interval,avatar,[])
File "jumpingjacks_template(1).py", line 316, in engine
timer.update(interval)
AttributeError: 'list' object has no attribute 'update'