About Pygame, I need a picture to get smaller and soon dps return to their normal size, cm a button being pressed for example

Asked

Viewed 17 times

0

My main problem is that when I create a function to get the image back to normal size, instead of it shrinking back to normal, it simply skips the step of shrinking the image.

(it does not have the function of returning to normal)

if comando[pygame.K_SPACE]:   
            fm=[]
            for i in range(5):
                ll=random.randint(0,4)
                if ll==1:
                    vetorrosa.diminuir()
                    vetorrosa_group.update()
                    vetorrosa_group.draw(BACKGROUND)
                    fm.append(ll)
                    print('rosa')
                elif ll==2:
                    vetorazul.diminuir()
                    vetorazul_group.update()
                    vetorazul_group.draw(BACKGROUND)
                    fm.append(ll)
                    print('azul')
                elif ll==3:
                    vetormarinho.diminuir()
                    vetormarinho_group.update()
                    vetormarinho_group.draw(BACKGROUND)
                    fm.append(ll)
                    print('marinho')
                elif ll==4:
                    vetorvermelho.diminuir()
                    vetorvermelho_group.update()
                    vetorvermelho_group.draw(BACKGROUND)
                    fm.append(ll)
                    print('vermelho') 

Please, I would like to know how I can resolve this. I thank you for your attention.

  • If you don’t put a blank blank code that allows people to reproduce what you’re trying to, it’s not possible to answer. We do not need to have all the options of "Elif" - but it is necessary to have the code of the class of this "marine vector" - and the method "decrease" - if it has a main function that has the steps of drawing the image on the screen,and load the image from disk - better.

  • That being said: you don’t know what your "decrease" method does - but you will need to store several copies of the image in memory: 1 for each size you want to show - and only change the attribute that is drawn within the "draw" method (it must be the "image" attribute of each Sprite) - to refer to the desired size.

  • S had there the minimum code to disengage what you want on the screen, it would be very quiet to answer - the way it is, it is impossible.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.