Aug-02-2020, 02:59 PM
Hi everybody. I've just created a simple moving object and now I need to save it as a video file. Can anybody tell me how can I save the output and which format I should choose? Also if you also introduce a source to learn it, it would be great. I also put my code here to make a sense of what it's like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import pygame pygame.init() screen = pygame.display.set_mode(( 1000 , 1000 )) pygame.display.set_caption( 'visual rhythm' ) icon = pygame.image.load( "song.png" ) pygame.display.set_icon(icon) playerImg = pygame.image.load( 'spaceship.png' ) playerX = 370 playerY = 400 def player(x,y): screen.blit(playerImg,( int (x), int (y))) speed = [ 4000 , - 2000 , 2000 , - 1000 , 1333 , - 4000 ] count = 0 count2 = 0 clock = pygame.time.Clock() while count2< len (speed): screen.fill(( 0 , 255 , 0 )) milli = clock.tick() seconds = milli / 1000.0 dm = seconds * speed[count] playerY + = dm player(playerX,playerY) pygame.display.update() if playerY> = 946 or playerY< 1 : count + = 1 count2 + = 1 |