Public Group

# enemie spawning problems! (blitz3d)

This topic is 3889 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
c'mon i need help!

##### Share on other sites
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.

##### Share on other sites
Quote:
 Original post by bobwritMake 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.

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?)

b = b +1

..

##### Share on other sites
Quote:
Original post by zabo
Quote:
 Original post by bobwritMake 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.

score#=score#+1 replace it with
b+1?

Keep
score#=score#+1
in there but add b=b+1 in the loop.

oh hey thanks!

triple post

triple post

1. 1
Rutin
18
2. 2
3. 3
JoeJ
13
4. 4
5. 5

• 16
• 18
• 10
• 13
• 17
• ### Forum Statistics

• Total Topics
631694
• Total Posts
3001747
×