Jan-11-2020, 11:25 AM
Dear fellow Python coders,
I have created a platformer where all of the graphics are blocky, but they are just pixels I coded. For example, for the platforms that the player stands on, I did this:
Thank you for all your help!
I have created a platformer where all of the graphics are blocky, but they are just pixels I coded. For example, for the platforms that the player stands on, I did this:
platforms = [ [20,180,30,10], [20,140,30,10], [20,100,30,10], ] PLATFORM = (128,128,128)#Grey for platform in levels.platforms: pygame.draw.rect(window, PLATFORM, convertGridToPixels(platform, offset))Everything works somewhat smoothly, but I want to change the graphics from blocks to images. How would I be able to do this? I want to mainly do this with the character itself, which is coded as such:
PLAYER = (255,255,255)#White player = Rect([20,200,10,20]) scale = 2 offset = [0,25*scale] centering = [255,300] #Re-centering the screen around the player offset[0] = -centering[0] + player.x*scale offset[1] = -centering[1] + player.y*scale #Draw player draw = convertGridToPixels(player, offset) pygame.draw.rect(window, PLAYER, draw)Could you please help me change this format so I can insert a picture for the player instead of having it as a block?
Thank you for all your help!