#πŸ”’ Replacing an image on Pygame

17 messages Β· Page 1 of 1 (latest)

iron vapor
#

I need to replace the top down image of my character with one of its rotated varients depending on what key is pressed, but I cannot manage it.

plush baneBOT
#

@iron vapor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

steel fjord
#

And the png for the rotated part?

iron vapor
#

my 4 varients for left, right, up and down are all seperate PNGs loaded into the file

steel fjord
#

If you want to manipulate "image" with keybinds in pygame, make a sprite class for it.

iron vapor
#

okay i'll try to figure that out, thanks

steel fjord
#

Add transitions to whatever you want.

#

Then call said transitions whenever the key is pressed.

iron vapor
#

okay thanks man

steel fjord
#

My pleasure

#

Join vc 1 if you like, I'm actually working on a 2d game with arcade. I can show you how we make sprites logically speaking.

#

I haven't done it in pygame as well yet, but same logic applies.

plush baneBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.