|
Post by BiNMaN on Apr 11, 2012 22:51:57 GMT
When designing Trooper:Point 5 I was always conscious of the number of sprites that AGD could have on screen at once (being 12), too many and a sprite may disappear (for example there are 4 enemies at at time so too many bullets being printed may stop an enemy or a prize from respawning). Being a clone of Jet Pac I wanted the bullets to be single and autofire at the same time (ie hit fire once one bullet, hold down the fire key and they are continuous)
What I wanted to do is limit the number of bullets on screen to 3 but also have them firing continuously in rapid succession and also trying not to use too many global variables.
Where (T) is the sprite type and (I1)/(I2) are the image for the bullet, DIRECTION chooses which image is used which in turn would determine the movement (being left or right) in the bullet sprite type.
IF KEY 4 IF A = 0 IF DIRECTION = 1 SPAWN (T) (I1) ELSE SPAWN (T) (I2) ENDIF ENDIF ADD 1 TO A IF A = 4 LET A = 0 ENDIF ENDIF IF KEY 4 ELSE LET A = 0 ENDIF
In conjunction with this I added the next bit to the sprite type routine for the bullet, this way would limit the number of bullets on screen to 3. This would limit how long the bullet would be on screen for, whereas the distance and speed would be determined by the number of spriteleft/spriteright statements.
ADD 1 TO PARAMA IF PARAMA = 9 REMOVE ENDIF
|
|