Oh, also, i notice you aren't actually deleting the bullets once they've hit something. Add in:
In the "PlayerCollisions()" function, just below where you check the Y position of the bullet. :o) To make the function read:
I also moved the part where you move the bullets, to before the collision check is done, to make sure it doesn't miss.
If bullet\alive = 0 Then Delete bullet.bullet End If
In the "PlayerCollisions()" function, just below where you check the Y position of the bullet. :o) To make the function read:
Function PlayerCollisions() ;Reset the collisions variables playerup = False playerleft = False playerright=False playerdown = False ;Start Collision Detection ;solid For x = 0 To mapsizex For y = 0 To mapsizey If map(0,x,y)>0 Then;if there is something occupying the current x,y position in the Map array If ImagesCollide(player\image ,player\x+collisioncheck ,player\y ,player\imagehandle ,gfx_tiles,x*32,y*32,map(0,x,y)) Then playerright = True ;IF the player collided with the current tile on his right If ImagesCollide(player\image ,player\x-collisioncheck ,player\y ,player\imagehandle ,gfx_tiles,x*32,y*32,map(0,x,y)) Then playerleft = True ;IF the player collided with the current tile on his left If ImagesCollide(player\image ,player\x ,player\y+collisioncheck ,player\imagehandle ,gfx_tiles,x*32,y*32,map(0,x,y)) Then playerdown = True;IF the player collided with the current tile below him If ImagesCollide(player\image ,player\x ,player\y-collisioncheck ,player\imagehandle ,gfx_tiles,x*32,y*32,map(0,x,y)) Then playerup = True;IF the player collided with the current tile Above Him EndIf Next Next ;check collision for the pickups For pickup.pickup=Each pickup If pickup\alive =1 Then If ImagesCollide(player\image,player\x,player\y,player\imagehandle ,pickup\image ,pickup\x,pickup\y ,pickup\imagehandle ) Then pickup\alive =0 ;remove the pickup pickupid=pickupid-1 player\score=player\score+10 EndIf End If Next Local bullet_dead = 0 ;check collision for the bullets For bullet.bullet=Each bullet If bullet\alive =1 Then bullet\y =bullet\y -5 ;move the bullet upwards if not hit anything For enemy.enemy=Each enemy If enemy\alive =1 Then If ImagesCollide(enemy\image,enemy\x,enemy\y,enemy\imagehandle ,bullet\image ,bullet\x,bullet\y ,bullet\imagehandle ) Then enemy\alive =0 ;remove the enemy bullet\alive =0 ; remove the bullet player\score=player\score+10 End If EndIf Next If bullet\y=<0 Then ;if bullet off top of screen then delete and dont show bullet\alive =0 End If If bullet\alive = 0 Then Delete bullet.bullet End If End If Next End Function
I also moved the part where you move the bullets, to before the collision check is done, to make sure it doesn't miss.