I dunno if the title was very specific, but what I meant was that I want a class object to go directly to another place. By directly, I mean you can see it going towards it. I can change the x & y variables of that class object, yet I don't know how much to change it at what time. There should something that should help with that right?
This is what I've gotten with the class so far:
class gems(pygame.sprite.Sprite):
def __init__(self, which_gem):
self.gem_x = random.randint(500, 600)
self.gem_y = random.randint(500, 600)
def gem_spawn(self):
which_gem = random.randint(1, 4)
if which_gem == 1:
self.gem = pygame.image.load('gem1.png')
elif which_gem == 2:
self.gem = pygame.image.load('gem2.png')
elif which_gem == 3:
self.gem = pygame.image.load('gem3.png')
elif which_gem == 4:
self.gem = pygame.image.load('gem5.png')
screen.blit(self.gem, (self.gem_x, self.gem_y))
pygame.display.flip()
Also, just in case you're wondering, I want the class object to move to the mouse position.
Thanks