-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make pygame display adjust to screen size #17
base: master
Are you sure you want to change the base?
Conversation
Make the following adjust to screen size - Background size - Squares' and circles' size - Cars' size - Font size - Perceived speed of cars
if (self.soon_to_draw.x_to_draw > self.middle_of_screen_x and | ||
self.soon_to_draw.object != self.lastright.object): | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for parentheses.
if (self.soon_to_draw.x_to_draw < self.middle_of_screen_x and | ||
self.soon_to_draw.object != self.lastleft.object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
right_car_right_bound = self.lane_4 - self.car_center | ||
if self.left_moved: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new line before the condition would be good for code organization.
self.restart, (124, 124)), (550 - 2, 420 - 2)) | ||
game.screen.blit(self.scorescreen, (game.background_x, 0)) | ||
|
||
# Display GAME OVER in the middle of screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment, please remove.
Also remove other redundant comments .ie. comments where the code makes it obvious what's being achieved.
game.screen.blit( | ||
self.play_button_rescaled, ( | ||
game.middle_of_screen_x - ( | ||
self.play_dimensions) * 1.1 // 2, | ||
game.screen_height // 2 - ( | ||
self.play_dimensions) * 1.1 // 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
game.screen.blit(
self.play_button_rescaled,
game.middle_of_screen_x \
- (self.play_dimensions * 1.1) // 2,
game.screen_height // 2 \
- (self.play_dimensions * 1.1) // 2
)
Seems more readable as we know were the blit starts and ends.
For the grouping of the parentheses, self.play_dimensions
being grouped by itself doesn't sit right with me so I'm guessing you multiply and then divide the product of that.
game.screen.blit(self.play_button, ( | ||
game.middle_of_screen_x - (self.play_dimensions) // 2, | ||
game.screen_height // 2 - (self.play_dimensions) // 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
game.screen.blit(
self.play_button,
game.middle_of_screen_x - (self.play_dimensions // 2),
(game.screen_height // 2) - (self.play_dimensions // 2)
)
Also looks more readable.
# Show Rules screen | ||
else: | ||
game.screen.blit(self.rulescreen, (350, 0)) | ||
game.screen.blit(self.rulescreen, (game.background_x, 0)) | ||
# Check if start button is hovered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment.
game.screen.blit( | ||
self.play_button_rescaled, ( | ||
game.middle_of_screen_x - ( | ||
self.play_dimensions) * 1.1 // 2, | ||
game.screen_height * 0.8 - ( | ||
self.play_dimensions) * 1.1 // 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to know where the blit starts and ends.
game.screen.blit(self.play_button, ( | ||
game.middle_of_screen_x - ( | ||
self.play_dimensions) // 2, | ||
game.screen_height * 0.8 - ( | ||
self.play_dimensions) // 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too, you can look at the changes I made and make it more readable.
Reviewed 7929cef, not tested. |
Is this fixed by recent Sugargame fix? |
Quite possible, I'll test to find out. |
@chimosky, kindly review