Second day: scroll
I've improved the tiles, just a little bit, to fix some awkward cases I didn't like.And then started with the scroll... :(
Worth reading: a newbie guide to pygame, or TL;DR: among lots of interesting stuff, I learnt today that there are some kinds of scroll you can't implement with pygame because of performance.
Nevermind. I think I've got a reasonable scroll with 30 FPS (sic). And that's all for today.
Tomorrow I'll try to add the main character and start playing with physics for the red blood cells (oh, please... don't take it too seriously!).
Update: read the comments!
(log in to comment)
Comments
The scroll I've implemented looks OK to me, even at 30 FPS, but I wouldn't call it smooth. After trying Fractured Soul, and I must be doing something wrong!
I've tried different approaches, and right know I'm just bliting from from a big surface with ALL the scenario already drawn (can I have your memory?). So I can lock the surface and I don't need to unlock it again!
I'm looking forward to go try the locking thing this evening!
You can't blit a locked surface (probably I got bitcraft comment wrong).
http://pygame.org/wiki/ConstantGameSpeed
and it really works better, but I don't understand why. I better keep working in other things before I get out of time!
i don't know if you are doing this or not, but i've seen some people do a load(image).convert() every time they blit an image. if you are doing this, it could be so much faster if you pre-load (and convert!) all the tiles into a list or dictionary, then when you are blitting them, just get the image from the list or dictionary. Most computers these days should have no problem with this using simple pygame surfaces.
reidrac, although constant game speed sounds cool, i tend to design games where the speed is as fast as possible, then just cap the framerate. its so much easier that way.
also, i have a pet peeve with frames dropping, especially in action style games. i'd rather the game slow down if the action is too much, rather that it dropping frames and putting me in a situation where i die or do something stupid because the game locked up and i couldn't control it.
Cosmologicon on 2011/09/12 22:25:
Over time the advice about performance on that page will become less and less true. I've never used the dirty rect animation they give in Rule #5 and I always find a way to make things work in pygame. Granted I'm not as demanding as most players; I think that 30fps is just fine. But still I think it's a bit much to say that there are some kinds of scroll you can't implement in pygame because of performance. Your graphics don't look any more complicated than what we did in Fractured Soul, and the engine we used for that game (gummworld2) just calls pygame.display.flip.