Hello
I have a problem about standby animation
That i want is if i didn't touch keyboard, object will do brs_stop
but if i touch "D" it will move and do the animation brs_mv
It's my Code
Please help
Thank you
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.*; /** * Write a description of class BRS here. * * @author (your name) * @version (a version number or a date) */ public class BRS extends Actor { public int anim_reap = 1; public int anim_reap_run = 10; public int frame = 24; private int spd_brs = 2; public static int curr_brsX; public static int curr_brsY; private int brsX; private int brsY; private BRS_RH RH; GreenfootImage act_brs1 = new GreenfootImage("/Normal Act/1.png"); GreenfootImage act_brs2 = new GreenfootImage("/Normal Act/2.png"); GreenfootImage act_brs3 = new GreenfootImage("/Normal Act/3.png"); GreenfootImage act_brs4 = new GreenfootImage("/Normal Act/4.png"); GreenfootImage act_brs5 = new GreenfootImage("/Normal Act/5.png"); GreenfootImage act_brs6 = new GreenfootImage("/Normal Act/6.png"); GreenfootImage act_brs7 = new GreenfootImage("/Normal Act/7.png"); GreenfootImage act_brs8 = new GreenfootImage("/Normal Act/8.png"); GreenfootImage act_brs9 = new GreenfootImage("/Normal Act/9.png"); GreenfootImage act_brs10 = new GreenfootImage("/Normal Act/10.png"); GreenfootImage act_brs11 = new GreenfootImage("/Normal Act/11.png"); GreenfootImage act_brs12 = new GreenfootImage("/Normal Act/12.png"); GreenfootImage act_brs13 = new GreenfootImage("/Normal Act/13.png"); GreenfootImage act_brs14 = new GreenfootImage("/Normal Act/14.png"); GreenfootImage act_brs15 = new GreenfootImage("/Normal Act/15.png"); GreenfootImage act_brs16 = new GreenfootImage("/Normal Act/16.png"); GreenfootImage act_brs17 = new GreenfootImage("/Normal Act/17.png"); GreenfootImage act_brs18 = new GreenfootImage("/Normal Act/18.png"); GreenfootImage act_brs19 = new GreenfootImage("/Normal Act/19.png"); GreenfootImage act_brs20 = new GreenfootImage("/Normal Act/20.png"); GreenfootImage act_brs21 = new GreenfootImage("/Normal Act/21.png"); GreenfootImage act_brs22 = new GreenfootImage("/Normal Act/22.png"); GreenfootImage act_brs23 = new GreenfootImage("/Normal Act/23.png"); GreenfootImage act_brs24 = new GreenfootImage("/Normal Act/24.png"); GreenfootImage act_brs25 = new GreenfootImage("/Normal Act/25.png"); GreenfootImage act_brs26 = new GreenfootImage("/Normal Act/26.png"); GreenfootImage act_brs27 = new GreenfootImage("/Normal Act/27.png"); GreenfootImage act_brs28 = new GreenfootImage("/Normal Act/28.png"); GreenfootImage act_brs29 = new GreenfootImage("/Normal Act/29.png"); GreenfootImage act_brs30 = new GreenfootImage("/Normal Act/30.png"); GreenfootImage act_brs31 = new GreenfootImage("/Normal Act/31.png"); GreenfootImage act_brs32 = new GreenfootImage("/Normal Act/32.png"); GreenfootImage act_brs33 = new GreenfootImage("/Normal Act/33.png"); GreenfootImage act_brs34 = new GreenfootImage("/Normal Act/34.png"); GreenfootImage act_brs35 = new GreenfootImage("/Normal Act/35.png"); GreenfootImage act_brs_run1 = new GreenfootImage("/Run Act/1.png"); GreenfootImage act_brs_run2 = new GreenfootImage("/Run Act/2.png"); GreenfootImage act_brs_run3 = new GreenfootImage("/Run Act/3.png"); GreenfootImage act_brs_run4 = new GreenfootImage("/Run Act/4.png"); GreenfootImage act_brs_run5 = new GreenfootImage("/Run Act/5.png"); GreenfootImage act_brs_run6 = new GreenfootImage("/Run Act/6.png"); GreenfootImage act_brs_run7 = new GreenfootImage("/Run Act/7.png"); GreenfootImage act_brs_run8 = new GreenfootImage("/Run Act/8.png"); GreenfootImage act_brs_run9 = new GreenfootImage("/Run Act/9.png"); GreenfootImage act_brs_run10 = new GreenfootImage("/Run Act/10.png"); GreenfootImage act_brs_run11 = new GreenfootImage("/Run Act/11.png"); GreenfootImage act_brs_run12 = new GreenfootImage("/Run Act/12.png"); GreenfootImage act_brs_run13 = new GreenfootImage("/Run Act/13.png"); GreenfootImage act_brs_run14 = new GreenfootImage("/Run Act/14.png"); GreenfootImage act_brs_run15 = new GreenfootImage("/Run Act/15.png"); GreenfootImage act_brs_run16 = new GreenfootImage("/Run Act/16.png"); GreenfootImage act_brs_run17 = new GreenfootImage("/Run Act/17.png"); GreenfootImage act_brs_run18 = new GreenfootImage("/Run Act/18.png"); GreenfootImage act_brs_run19 = new GreenfootImage("/Run Act/19.png"); GreenfootImage act_brs_run20 = new GreenfootImage("/Run Act/20.png"); GreenfootImage act_brs_run21 = new GreenfootImage("/Run Act/21.png"); GreenfootImage act_brs_run22 = new GreenfootImage("/Run Act/22.png"); GreenfootImage act_brs_run23 = new GreenfootImage("/Run Act/23.png"); GreenfootImage act_brs_run24 = new GreenfootImage("/Run Act/24.png"); GreenfootImage act_brs_run25 = new GreenfootImage("/Run Act/25.png"); GreenfootImage act_brs_run26 = new GreenfootImage("/Run Act/26.png"); GreenfootImage act_brs_run27 = new GreenfootImage("/Run Act/27.png"); GreenfootImage act_brs_run28 = new GreenfootImage("/Run Act/28.png"); public void act() { // Add your action code here. curr_brsX = getX(); curr_brsY = getY(); //brs_stop(); if(Greenfoot.isKeyDown("D")){ brs_mv(); move(spd_brs); } } public void brs_stop(){ if(anim_reap % 3 == 0){ brs_norm_act_anim(); } anim_reap += 1; } public void brs_mv(){ if(anim_reap_run % 6 == 0){ brs_run_act_anim(); } anim_reap_run += 1; } public void brs_norm_act_anim(){ if(frame == 1){ setImage(act_brs1); frame = 2; } else if(frame == 2){ setImage(act_brs2); frame = 3; } else if(frame == 3){ setImage(act_brs3); frame = 4; } else if(frame == 4){ setImage(act_brs4); frame = 5; } else if(frame == 5){ setImage(act_brs5); frame = 6; } else if(frame == 6){ setImage(act_brs6); frame = 7; } else if(frame == 7){ setImage(act_brs7); frame = 8; } else if(frame == 8){ setImage(act_brs8); frame = 9; } else if(frame == 9){ setImage(act_brs9); frame = 10; } else if(frame == 10){ setImage(act_brs10); frame = 11; } else if(frame == 11){ setImage(act_brs11); frame = 12; } else if(frame == 12){ setImage(act_brs12); frame = 13; } else if(frame == 13){ setImage(act_brs13); frame = 14; } else if(frame == 14){ setImage(act_brs14); frame = 15; } else if(frame == 15){ setImage(act_brs15); frame = 16; } else if(frame == 16){ setImage(act_brs16); frame = 17; } else if(frame == 17){ setImage(act_brs17); frame = 18; } else if(frame == 18){ setImage(act_brs18); frame = 19; } else if(frame == 19){ setImage(act_brs19); frame = 20; } else if(frame == 20){ setImage(act_brs20); frame = 21; } else if(frame == 21){ setImage(act_brs21); frame = 22; } else if(frame == 22){ setImage(act_brs22); frame = 23; } else if(frame == 23){ setImage(act_brs23); frame = 24; } else if(frame == 24){ setImage(act_brs24); frame = 25; } else if(frame == 25){ setImage(act_brs25); frame = 26; } else if(frame == 26){ setImage(act_brs26); frame = 27; } else if(frame == 27){ setImage(act_brs27); frame = 28; } else if(frame == 28){ setImage(act_brs28); frame = 29; } else if(frame == 29){ setImage(act_brs29); frame = 30; } else if(frame == 30){ setImage(act_brs30); frame = 31; } else if(frame == 31){ setImage(act_brs31); frame = 32; } else if(frame == 32){ setImage(act_brs32); frame = 33; } else if(frame == 33){ setImage(act_brs33); frame = 34; } else if(frame == 34){ setImage(act_brs34); frame = 35; } else if(frame == 35){ setImage(act_brs35); frame = 1; } } public void brs_run_act_anim(){ if(frame == 1){ setImage(act_brs_run1); frame = 2; } else if(frame == 2){ setImage(act_brs_run2); frame = 3; } else if(frame == 3){ setImage(act_brs_run3); frame = 4; } else if(frame == 4){ setImage(act_brs_run4); frame = 5; } else if(frame == 5){ setImage(act_brs_run5); frame = 6; } else if(frame == 6){ setImage(act_brs_run6); frame = 7; } else if(frame == 7){ setImage(act_brs_run7); frame = 8; } else if(frame == 8){ setImage(act_brs_run8); frame = 9; } else if(frame == 9){ setImage(act_brs_run9); frame = 10; } else if(frame == 10){ setImage(act_brs_run10); frame = 11; } else if(frame == 11){ setImage(act_brs_run11); frame = 12; } else if(frame == 12){ setImage(act_brs_run12); frame = 13; } else if(frame == 13){ setImage(act_brs_run13); frame = 14; } else if(frame == 14){ setImage(act_brs_run14); frame = 15; } else if(frame == 15){ setImage(act_brs_run15); frame = 16; } else if(frame == 16){ setImage(act_brs_run16); frame = 17; } else if(frame == 17){ setImage(act_brs_run17); frame = 18; } else if(frame == 18){ setImage(act_brs_run18); frame = 19; } else if(frame == 19){ setImage(act_brs_run19); frame = 20; } else if(frame == 20){ setImage(act_brs_run20); frame = 21; } else if(frame == 21){ setImage(act_brs_run21); frame = 22; } else if(frame == 22){ setImage(act_brs_run22); frame = 23; } else if(frame == 23){ setImage(act_brs_run23); frame = 24; } else if(frame == 24){ setImage(act_brs_run24); frame = 25; } else if(frame == 25){ setImage(act_brs_run25); frame = 26; } else if(frame == 26){ setImage(act_brs_run26); frame = 27; } else if(frame == 27){ setImage(act_brs_run27); frame = 28; } else if(frame == 28){ setImage(act_brs_run28); frame = 1; } } }