+ 1

python pygame

code may not run here cuz, the pygame module and other images that i have loaded getting an error that it was expecting an integer argument but got float, on line 135 can't tell exactly why it's converting into a float if it's being a pain run this code.... i'm on pycharm, can open the link for it or get on repl .it, to do a live code.. https://code.sololearn.com/cE6YgxmT0ddW

14th Aug 2021, 11:52 PM
Tomoe
Tomoe - avatar
3 Answers
+ 1
Unfortunately I can't run it because of the pygame dependency and the code is a bit long to just read line by line. But here are some suggestions on how you may be able to find the problem. Since the line is in a function definition I recommend you figure out which call of the function causes the error, print out which values are passed to the function. You can also try just converting to integer using int() to see if there are further issues. But careful this can hide a deeper issue, so you should only use int() for debugging purposes.
15th Aug 2021, 12:30 AM
Simon Sauter
Simon Sauter - avatar
0
Line 152: Player is initialized with H/2 which is always a float, you should use H//2 (euclidean division)
15th Aug 2021, 2:07 AM
Angelo
Angelo - avatar
0
Angelo Thanks man, i was going over it for like 3 hours and still couldn't find where it was converting it
15th Aug 2021, 8:39 AM
Tomoe
Tomoe - avatar