Skip to content
Snippets Groups Projects
Commit cd3757c4 authored by Robert Seimetz's avatar Robert Seimetz
Browse files

Fix time() overriding library time

parent 90855fa3
No related branches found
No related tags found
No related merge requests found
......@@ -132,8 +132,8 @@ class _AnimatedObject(pygame.sprite.Sprite):
self.image = get_image_from_Spritesheet(self.spritesheet, self.spritesize, self.current_frame, self.size).convert_alpha()
def update(self):
if (time()-self.time_lastframe) > (1/self.animationspeed):
self.time_lastframe = time()
if (timer()-self.time_lastframe) > (1/self.animationspeed):
self.time_lastframe = timer()
self.current_frame[0] += 1
if self.current_frame[0] >= self.maxframe[0]:
......@@ -304,7 +304,7 @@ def add_music(file, repeats):
pygame.mixer.music.load("./sound/" + str(file))
pygame.mixer.music.play(repeats)
def time():
def timer():
time_in_seconds = pygame.time.get_ticks() / 1000
return time_in_seconds
......
......@@ -2,7 +2,7 @@ import pygame
import math
from settings import *
from gameparts.basics import _Object, _AnimatedObject, time, get_image_from_Spritesheet
from gameparts.basics import _Object, _AnimatedObject, timer, get_image_from_Spritesheet
class Coin(_Object):
def __init__(self, location, size, image="Golden.png"):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment