Solution for Pygame + Cron Trigger function
is Given Below:
I’ve been making a game by using pygame for some time.
I’ve already made player stats like Hungry, Thirst etc.
I’d like to make this parameters to decrease every minute. To do this I made Im_Hungry function. The only thing left me to do is triggering this function every minute.
Once I was making discord bot I used CronTrigger function to do somethin similar, so I decited to use it again, but this time in pygame.
thats my code
sched = BlockingScheduler() sched.add_job(Im_Hungry, 'cron', second='0') sched.start()
I also tried to do this this way
scheduler = AsyncIOScheduler() scheduler.add_job(Im_Hungry, CronTrigger( second = "0")) scheduler.start()
But it doesnt work.
I tried to put it in main while loop but my program is getting freezed
Have you got any Idea how can I make hungry system done ?
I did it.
I had to put
into main loop
at the start of my project