enemie spawning problems! (blitz3d)
heres a peice of code---->
While Not Keyhit(1)
If score#=100 then
Dim alien(150)
b = 1 to 150
alien(b)=LoadMesh("alien.b3d")
PositionEntity alien(b),Rnd(-100,100),100,Rnd(300,1000)
score#=score#+1
Next
EndIf
I originally thought that it would stop creating aliens if it added 1 to the score but instead it creates thousands! how can i make it so it only creates 150 aliens instead of looping hundreds of times creating a huge number of aliens? (p.s. it doesnt create an unlimited amount of aliens just alot maybe cuz i continue to shoot em adding points) how do i solve this problem?
Make it so that as soon as the enemy is created you add 1 to b . Otherwise b will stay at 1 and you create an infinite loop.
Quote:Original post by bobwrit
Make it so that as soon as the enemy is created you add 1 to b . Otherwise b will stay at 1 and you create an infinite loop.
so instead of
score#=score#+1 replace it with
b+1?
so simple! (p.s. how do i create a check point /savepoint or save option for my game?)
Quote:Original post by zaboQuote:Original post by bobwrit
Make it so that as soon as the enemy is created you add 1 to b . Otherwise b will stay at 1 and you create an infinite loop.
so instead of
score#=score#+1 replace it with
b+1?
Keep
score#=score#+1
in there but add b=b+1 in the loop.This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement