Hey guys making a little game and having some trouble with the bullets. never really done anything shooter related and having trouble making some code to shoot, detect, and remove bullets. If you spam click and just click around you'll notice some bullets disappear for no reason. also for some reason i get occasional stutters anyone know why?
note a lot of aliens might go to the earth (its random chance) just testing the collision, which is the same thing i used for the projectiles but no problems like the projectiles?
projectile help
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
projectile help
- Attachments
-
- WorldsatWar.love
- (23.72 KiB) Downloaded 128 times
Re: projectile help
No, it's not the same thing.
To mark the aliens for deletion, you use: table.insert(RaidHit, i) but for the bullets, you use: ProjectileTrash[i] = i. The latter is not correct, because the index of the bullet is not valid as an index into the ProjectileTrash array. It creates holes in the ProjectileTrash array; you're lucky it works at all.
You can use table.insert, like with the aliens, or you can use a variable that you initialize with zero, and tells you how many elements are there in the ProjectileTrash array.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests