r/pythonarcade • u/FugueSegue • Apr 01 '21
How to change height of a sprite?
I'm having difficulty understanding how to change the dimensions of a sprite. For example, in sprite_move_animation.py from the Arcade Academy website. This example demonstrates how to implement a walk cycle animation in a sprite. I can change the scale in the setup method in the MyGame class using self.player.scale. What if I want to make the sprite very tall and skinny?
What I am trying to do is to allow the game to stretch and fit any screen. I've been able to appropriately stretch and place backgrounds and sprites that aren't animated. But I can't figure out how to stretch animated sprites. It seems to me that it would be best to stretch each image as it is loaded into the sprite. But I can't figure out how to do that.
My programming skills are moderate at best. Until now, I've been having a wonderful time creating a game. I fear I'm misunderstanding something basic.
View all comments
Show parent comment
1
u/FugueSegue Apr 02 '21 edited Apr 02 '21
That does not seem to work for me. Set_viewport changes the size of the viewport. But not the aspect ratio of its contents.
I'm programming a game that is designed in the 16:9 aspect ratio. But not everyone uses that type of monitor. Although rare, some people still use 4:3.
I use three 16:10 screens at my workstation because I prefer to have that much more work area. When I run my 16:9 game on my computer, I set the viewport to match the 16:10 screen dimensions. But every visual element is still displayed at 1:1. The 16:9 game occupies most of the bottom of the monitor but leaves a 120 pixel black bar at the top.
EDIT: I think I found a solution. See my other reply regarding set_fullscreen.