this code below this line is looping though 3 pictures. so it will display pic 1, 2, 3, 1, 2, 3,... and so on. but i want it do stop when it picture is 3.
float frame = 0; double frame_speed = 0.1; //how fast to loop through pictures int pictures = 0; //how many pictures to loop from public void animation_player() { int tester = (int)(frame + frame_speed); if(tester < pictures) { frame += frame_speed; } else { frame = 0; } }
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; pictures = 3; //6 picture on sheet g2d.drawImage(player_image, x, y, x+width, y+height, 50*(int)frame, 147, 50*(int)frame+50, 189 ,Sprite_Sheet.m1); }
iam thinging in if statment may be add another else if(tester == 3)...