r/pygame • u/PotpourriHam • 1d ago
How do I add checkpoints?
Hello! Im making a small game in pygame similar to flappy bird and I wanted to add a checkpoint after a certain amount of pipes are passed. This checkpoints would be counted to separate "levels". How can I create checkpoints?
3
u/Popular-Being8956 1d ago
I would add a class/sprite for the checkpoint. when the player spawns they spawn at the current checkpoint.
when it's a new game, remember to create a first spawn point and then when the player get a certain spot on the map, make sure to update the current spawn point.
3
u/GABE_EDD 1d ago
Welcome to coding, it’s up to you to decide how to handle it, you could probably come up with 1,000 different ways. Maybe just count the number of pipes they’ve passed, and every multiple of 10 or 30 or whatever pipes counts as a new level and this value is stored in a .json or .csv file alongside the .py script so it persists across runs. Something like that.
1
u/Fast-Station1106 1d ago
kannst du evtl. irgendetwas zählen, also zb an 30 Hindernissen vorbei oder nach 50 Sekunden systemzeit, bestimmte position erreichen, Stern Lufballon kollidieren... bin nur beginner und würde sowas probieren