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.
Expand|Select|Wrap|Line Numbers
- if(space)
- {
- bulletObject = new Bullet(); //create bullet
- bulletStore.add(bulletObject); //store in arraylist
- }
if user hit 'f' key than change bullet type.
Expand|Select|Wrap|Line Numbers
- if(f)
- {
- bulletName ++; //go to next bullet type
- }
Expand|Select|Wrap|Line Numbers
- pubic void paint(Graphics g)
- {
- if(bulletName == 1)
- g.setColor(Color.green);
- if(bulletName == 2)
- g.setColor(Color.blue);
- if(bulletName == 3)
- g.setColor(Color.red);
- g.fillOval(x,y,width,height);
- }
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