change surface

DL Neil PythonList at DancesWithMice.info
Sat Jun 13 17:25:59 EDT 2020


On 13/06/20 10:40 PM, Bischoop wrote:
> I'm playing with pygame, https://bpa.st/6GOQ
>   Not sure what is wrong here that object moves but draws another
>   surface.


(not sure how many will click on a link like that - best to copy-paste 
code into (text) email message)

The most usual reason for 'leaving' an old version of a surface visible, 
when a new frame is drawn by the game-loop, is that there is no code to 
'wipe' the old before painting the new 'on top'.

Either:
1 keep track of the position of each moving surface and before 
calculating its new position (and adding it to the background), execute 
appropriate code to wipe it (and restore whatever was 'underneath').
2 clear the entire display, and build it again from 'background' to 
'foreground'. (takes longer but is 'guaranteed')

-- 
Regards =dn


More information about the Python-list mailing list