Re: Strange issue with Python
Re: Strange issue with Python Also, if you start using mypy and type hints ASAP, it'll catch errors like this one for you. URL: https://forum.audiogames.net/post/565438/#p565438 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python Thanks guys, I found the issue. I noticed it was only happening when I used an automatic weapon, so I went to check the if lucia.key_down(pygame.K_SPACE) statement and noticed that it had been assigning the string to damage.Thanks for the help. URL: https://forum.audiogames.net/post/565417/#p565417 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python @4Right, so that means somewhere you're assigning the string hit.ogg to damage. We can't help you find that, but if it's a multi-file thing try grep -ri hit.ogg . or Windows Explorer search or something. URL: https://forum.audiogames.net/post/565342/#p565342 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python Hi,So i tried some of the things you guys said, and I ended up with this. File "C:\Users\Kazeem\Documents\RagePillow python\rp.py", line 169, in __init__ self.damage=int(dm)ValueError: invalid literal for int() with base 10: 'arhit.ogg' URL: https://forum.audiogames.net/post/565341/#p565341 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python Somewhere you're assigning a string to damage, then when it gets here it breaks. Try printing i.damage on the line prior and see what's going on.Remember that Python variables don't have types: you can accidentally do i.damage ="bob" instead of i.name="bob" and then it holds a string and explodes. URL: https://forum.audiogames.net/post/565323/#p565323 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python Without access to your code I can't know for sure, but by the error message it looks like damage has somehow been made a string.This same error occurs when you do something like the following:>>> health = 500 >>> damage = "lots and lots" >>> health -= damage Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for -=: 'int' and 'str' >>>Try printing it out. If you get a number, convert to an int by callingdamage = int(damage) URL: https://forum.audiogames.net/post/565322/#p565322 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Strange issue with Python
Re: Strange issue with Python Without access to your code I can't know for sure, but by the error message it looks like damage has somehow been made a string.This same error occurs when you do something like the following:>>> health = 500 >>> damage = "lots and lots" >>> health -= damageTry printing it out. If you get a number, convert to an int by callingdamage = int(damage) URL: https://forum.audiogames.net/post/565322/#p565322 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector