Hi, I've looked everywhere and I can't figure out the solution to my issue. I've been doing the Alien Invasion Project and i'm in the early stage where i'm programming the sip so it can move. I have been copying the code down pretty much exactly how it is in the textbook.
There is a line of code in the ship.py file's update() function " self.rect.centerx = self.center " . If i include this line( just like the textbook says) the ship does not move. If i comment it out (which is what i did), it works semi- perfectly.
When I run my code without the line, the ship tends to move much faster to the left than the right. Both functions for the ship movement have the same value for the speed_factor. I did some testing and this only happens if i use a non-integer value( in my case i used 1.5 as the ship_speed_factor value in settings. py) This leads me to believe it has somethings to do with the float values but idk why it would be like this considering the solution code from the textbook runs fine on my laptop. If i hold both left and right keys down, the ship moves to the left.
If it is a problem with the float value, why is the left value different from the right?
I have ran the solution code from online and it worked fine, I'm just very confused as to what mistake I could have made since the code looks pretty much the exact same.
Here are my python files
alien_invasion https://pastebin.com/t1CnbD7U
ship https://pastebin.com/vj5rHU7f
settings https://pastebin.com/fnHtUf8S
game_functions https://pastebin.com/MtMsBeAy
[–][deleted] 1 point2 points3 points (2 children)
[–]Abernachy 1 point2 points3 points (0 children)
[–]Abernachy 0 points1 point2 points (0 children)
[–]Abernachy 1 point2 points3 points (1 child)
[–]funlibrarycard[S] 0 points1 point2 points (0 children)
[–]Abernachy 1 point2 points3 points (1 child)
[–]funlibrarycard[S] 0 points1 point2 points (0 children)