Closed AdamSpannbauer closed 3 years ago
i don't think i can assign to myself, so let this serve as my self-assignement
awesome, I've been on vacation away from the computer, hows this going?
Currently sidetracked by school, but I think I have a general idea for the solution (python imaging library)
Instead of introducing a new library I think that pygame.transform.flip
should have us covered. The toughest part of this issue will be where/how to place flag indicating that the flip needs to be done. Perhaps as an instance attribute somewhere in the object hierarchy.
Yeah, that's what I was having trouble with. I saw that in most if not all of the cases, the image variable is passed in initialization, so in the current system, with my knowledge, there's no way to change image without initializing the whole thing over again so far
Do you know of a possible fix/resolution? I couldn't find anything on the internet, and a friend I asked said PIL was probably the better solution
There's an example image transformation in body.py
; you can use the flip
transform in the same way. PIL
would work just as well to flip the image, but it's unneeded. The logic of telling the process when to flip is what's needed.
Maybe Body
has a flip_img
attribute added to it and bullets check their x velocity on update
to set this attribute. There could be some interesting interactions with the rotate+flip logic but that should be solvable.
OK, I'll take a look once I get a chance.
@AdamSpannbauer see pull request
@AdamSpannbauer - tested and fixed (see new commits), enemies now turn around like they should
if x part of velocity is less than zero flip image asset horizontally