Hi Nik, many thanks for your very detailed response. I will go through your amended code to see where I went wrong and correct the issues - all part of the learning curve. I'm also happy to see your completely cleaned-up version if you have time. Currently, I'm interested in where I went wrong with the collision. Onwards and upwards.
Thanks again. Adam On 5 May 2014 11:23, Dominik George <n...@naturalnet.de> wrote: > Hi Adam, > > > What is the easiest way of detecting the collision between enemy and > > player? > > > > TIA > > > > My whole code is visible at: > > https://github.com/kabads/zoomr/blob/master/zoomr.py > > I went through your code and found it to be a bit strange. I guess you > started > using PyGame without sprites and have kept some bad habits. > > In particular, this means: > > * A sprite having an iamge attribute, but then using some other atribute > (your il) for drawing it with your own draw method makes no sense. > * Always update sprites with their update method > * Always keep the sprite's rect in sync with the sprite's position > * Always have all sprites in some group (also your player in a player > group) > * Draw groups as a whole, not every single sprite > > Also, please take a look at RenderClear and how to use the clear() method > for > clearing the screen surface more efficiently than drawing a solid > background. > > Find attached your code, amended with the things I said, but leaving its > structure intact. There are also some things about your general Python that > come to mind - if you care, I can send you a completely cleand-up version. > > Cheers, > Nik -- -- You back your data up on the same planet? http://www.monkeez.org PGP key: 0x7111B833