Typing out screen.blit(surface,(posx,posy))
over and over again for my games is very annoying. Is there a quicker way to do this?!
Asked
Active
Viewed 33 times
-2

Glitchd
- 361
- 2
- 12
1 Answers
0
Using a function can make it a lot shorter, for example
def blit(img,x,y):
screen.blit(img, (round(x),round(y)))
To call it you would use something like:
blit(mypicture,324,532)

Glitchd
- 361
- 2
- 12
-
2Consider that [`int`](https://docs.python.org/3/library/functions.html#int) truncate the number, while [`round()`](https://docs.python.org/3/library/functions.html#round) would round it up if the fraction part is `<=0.5`: `(round(x),round(y))` – Rabbid76 Jul 25 '19 at 08:54