I'm having a problem with my counter. When I run the program the count increases by one but not every enemy killed counts. And when i collect a key It won't count up at all. I don't know what I'm doing wrong.
enemies = 0
keys = 0
LoadImage ( 3, "fonts.png" )
SetTextDefaultFontImage ( 3 )
CreateText ( 1, "ENEMIES: 0" )
fixtexttoscreen ( 1, 1 )
SetTextPosition ( 1, 0, 0 )
settextcolor( 1, 255, 255, 0, 200 )
settextdepth ( 1, 1 )
SetTextSize (1, 20 )
CreateText ( 2, "KEYS: 0" )
fixtexttoscreen ( 2, 1 )
SetTextPosition ( 2, 220, 0 )
settextcolor( 2, 255, 255, 0, 200 )
settextdepth ( 2, 1 )
SetTextSize (2, 20 )
for b=10 to 100
for e=1000 to 1010
if getspriteexists ( 1000+e )
if getspritecollision ( 10+b, 1000+e )
enemies = enemies +1
SetTextString ( 1, "ENEMIES: " +str ( enemies ) )
endif
endif
next b
next e
for k=1022 to 1026
if getspriteexists ( 213 )
if getspritecollision ( 213, 1 )
keys = keys +1
SetTextString ( 2, "KEYS: " +str ( keys ) )
endif
endif
next k