Got a bit stuck with my game, trying to make a FPS with a few monsters on each level got quite far but my program is getting quite large becuase im not very good at optimizing my code take a look at my routine for collison checking and you'l see what i mean.
Knight_Fights:
if object playing(knight)=0 and knightdead=1
eyelevel=25
text 150,240, "YOU HAVE DIED PRESS SPACEBAR TO START AGAIN"
DeActivateObjPRO(player)
if spacekey()=1
ActivateObjPRO(player)
knightdead=0
Draw_Healthbar()
eyelevel=80
endif
exitfunction
endif
if knightdead=0 and NegativeHealth#=>476
SET OBJECT SPEED Knight,5000
play OBJECT Knight,56000,64000
knightdead=1
endif
if smackobjectplayer=20 and knightdead=0 and myenemy1dead=0 and myenemy1distance <75
DeductPlayer1Health()
smackobjectplayer=0
if object playing(Alien1)=0
SET OBJECT SPEED Alien1,30
play object Alien1,86,110
endif
endif
if smackobjectplayer=21 and knightdead=0 and myenemy1dead=0 and myenemy1distance <75
DeductPlayer1Health()
smackobjectplayer=0
if object playing(Alien1)=0
SET OBJECT SPEED Alien1,30
play object Alien1,86,110
endif
endif
if smackobjectplayer=22 and knightdead=0 and myenemy1dead=0 and myenemy1distance <75
DeductPlayer1Health()
smackobjectplayer=0
if object playing(Alien1)=0
SET OBJECT SPEED Alien1,30
play object Alien1,86,110
endif
endif
if smackobjectplayer=23 and knightdead=0 and myenemy1dead=0 and myenemy1distance <75
DeductPlayer1Health()
smackobjectplayer=0
if object playing(Alien1)=0
SET OBJECT SPEED Alien1,30
play object Alien1,86,110
endif
endif
if smackobjectmyenemy1=8 and knightdead=0 and myenemy1dead=0 and myenemy1distance <75
DeductPlayer1Health()
smackobjectmyenemy1=0
if object playing(Alien1)=0
SET OBJECT SPEED Alien1,30
play object Alien1,86,110
endif
endif
if smackobjectmyenemy2=8 and knightdead=0 and myenemy2dead=0 and myenemy2distance <75
DeductPlayer1Health()
smackobjectmyenemy2=0
if object playing(Alien2)=0
SET OBJECT SPEED Alien2,30
play object Alien2,86,110
endif
endif
if smackobjectmyenemy3=8 and knightdead=0 and myenemy3dead=0 and myenemy3distance <75
DeductPlayer1Health()
smackobjectmyenemy3=0
if object playing(Alien3)=0
SET OBJECT SPEED Alien3,30
play object Alien3,86,110
endif
endif
if smackobjectmyenemy4=8 and knightdead=0 and myenemy4dead=0 and myenemy4distance <75
DeductPlayer1Health()
smackobjectmyenemy4=0
if object playing(Alien4)=0
SET OBJECT SPEED Alien4,30
play object Alien4,86,110
endif
endif
return
Is there any way I can read in some of my variables names in a for next loop using read and data commands. Or maybe use an array or somthing I would be very grateful for any ideas
I tryed somthing like that but it did not work