../
By Spawning Multiple Objects In Pygame (Using Timers)
Timers
- custom user events that are triggered in certain time intervals
Method
- Create Custom Events
- Tell pygame to trigger that event continously
- Add code in event loop to do something the timer is triggered
pygame.time.set_timer(evetn to be triggered, time time interval in milliseconds)
- we create a list of obstacles rectangles
- everytime the timer triggers we add a new rectangle to that list
- we move every rectangle in that list to the left on every frame
- delete rectangles that goes too far left
Tags: /python/ /python3/ /pygame/ /gamedev/ /tutorial/ /animation/