I have tried making a simple system in my game where the player shoots where the mouse position is. But when i get the mouse position, i get a float tuple (I think that's what it's called)
Is there any way to round the mouse position.
This is the code (I have it changed it so the mouse pos gets printed instead of my whole game, but you get the jyst of it)
import pygame as pg
class Game:
def __init__(self):
pg.init()
pg.display.init()
self.screen = pg.display.set_mode((500, 500))
self.clock = pg.time.Clock()
def update(self):
print(pg.mouse.get_pos())
def run(self):
self.playing = True
while self.playing:
self.dt = self.clock.tick(FPS) / 1000
self.update()
def quit(self):
pg.quit()
g = Game()
while True
g.update()
And this is the error
self.pos += self.vel * self.game.dt ## This is a line of code that makes the movement smooth ## TypeError: can't multiply sequence by non-int of type 'float'
But as you can see, the output of the print(pg.mouse.get_pos())
isn't a float. Any ideas what's going on?