Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

Lol xD, how did you place so much, that's unbelievable!! By the way, yeah, if you cross a point like that, it's possible to make it a stalemate but I personally felt it's kind of uncommon to get to that place, I also did make it stalemate like that in my game, but it happened uncommonly and rarely (probably also because I might have hold the title bar of game) .. Anyways, I'm thinking to make Green vs Red 2 someday, it may not be like this!

One more thing, in Pygame window, when I hold the title bar, the game actually pauses and time does not, that also may lead to bullets getting fired once and make them more powerful cuz my bullets are kind of glitchy, did you do something like that? Also, do you know how can we stop Pygame Window to pause game when we hold on the title bar of the window?

Thanks a lot for replying :)

Update : I think I'm going to implement health system for Red units, they will have 0 health at the beginning, but as a certain time passes (say 30 seconds), their health will increase by 1 (which means Green units will need 1 more bullet to take the Red units out)

(1 edit) (+1)

Welcome! Also, regarding the case of holding the title bar, if you are using the pygame.Clock() as your game timer, then you will always experience a time-skip everytime you drag/hold the title bar. This is due to the internal timer not stopping and your screen not updating, causing a gap in the time interval (ticks or time_delta) about the same length as the time you held the title bar.

If your sprite's update function depends on the number of ticks, then I suggest filtering out (or limiting it) on the part where you get the number of ticks. For example, let's say your timer is called "timer", then you can use:

time_delta = min(1/fps, timer.get_time()/1000)

as your game's time_delta, which will treat the time above the limit as redacted time/pause time and remove it from computation. This line will make is so that the update will only receive a maximum of 1/fps seconds of update time (btw, this is what I usually use to avoid over the top time updates). There are other, much advanced way of doing filtering and one of those is what you may need to "PAUSE" the game when dragging the window. Though I can't explain it here as that will be too long.

Hope this helps!


Edit: Sorry for the small mistake, it should be min and not max to filter out large deltas.

(5 edits)

Thanks for the reply, I know about the fact when we hold the title bar is hold down, the game actually pauses but the internal time does not, but I don't know properly how to use timers in Pygame, I am currently using Userevents and Pygame.time.get_ticks() to control time things, anyways, I will probably look into it and research on it further someday because I have not used timers in this way in Pygame, but I think I'm kind of understanding what you are doing, you are trying to filter out the time used in the last frame by doing 1/FPS so that it will take it in account if the second argument of max (actual time) is less (because when we would hold down the title bar, the last frame will pause) or something like that, either way hopefully I will understand it properly when I would research on it, thanks a lot for replying and helping me! Appreciate it so so much!! :)

Lol, 5 edits!! xD