i need some help with java. i am creating a game where i have a player and he shoot bullets. u can also change u types of bullet.
bullets are just fillOval. and change types of bullets is different colo.
i have created a class bullet. which just create one bullet.
than if player hit space bar. than create a bullet and store in arraylist.
bulletObject = new Bullet(); //create bullet
bulletStore.add(bulletObject); //store in arraylist
now to change bullets. i have create a variable call bulletName. if it has a value of 1 than its bullet type is 1. If it has value of 2 than its bullet type is 2.
if user hit 'f' key than change bullet type.
bulletName ++; //go to next bullet type
now to draw the bullets.
pubic void paint(Graphics g)
if(bulletName == 1)
if(bulletName == 2)
if(bulletName == 3)
The problem is that if user hit space bar than it will shoot one bullet. than if user hit 'f' key than it will change color of all bullets on screen.
i want it so that it doesnt change color of bullets on screen. it only change color of bullet that are about to get shoot.change