void walkAnimationFunc(){
int play_pet_loop_times = 0;
int mod = 0;
int last_pet_index = 0;
play_pet_loop_times = 0;
//code added is as follows
int picWidth = 600;
int threshold = -picWidth;
int pic1_x = 0;
int pic2_x = picWidth;
int could1_x = 0;
int could2_x = picWidth;
pet1_walk_1.isVisible=1;
pet1_walk_2.isVisible=0;
pet1_walk_3.isVisible=0;
pet1_walk_4.isVisible=0;
pet1_walk_5.isVisible=0;
pet1_walk_6.isVisible=0;
pet1_walk_7.isVisible=0;
pet1_walk_8.isVisible=0;
while( 1==1 ) {
play_pet_loop_times = play_pet_loop_times + 1;
//code added is as follows
mod = play_pet_loop_times % 6;
pic1_x = pic1_x - 1;
pic2_x = pic2_x - 1;
could1_x = could1_x - mod;
could2_x = could2_x - mod;
if (pic1_x <= threshold ) {
pic1_x = picWidth;
}
if (pic2_x <= threshold ) {
pic2_x = picWidth;
}
if (could1_x <= threshold ) {
could1_x = picWidth;
}
if (could2_x <= threshold ) {
could2_x = picWidth;
}
could_1.absoluteX=could1_x;
mountain_1.absoluteX=pic1_x;
handrail_1.absoluteX=pic1_x;
could_2.absoluteX=could2_x;
mountain_2.absoluteX=pic2_x;
handrail_2.absoluteX=pic2_x;
mod = play_pet_loop_times % 4;
last_pet_index = mod;
if (last_pet_index == 0){
last_pet_index = 4;
}
mod = mod + 1;
view.disableAutoRepaint();
view.setVisible( "pet1_walk_" + toStr(last_pet_index), 0);
view.setVisible( "pet1_walk_" + toStr(mod), 1);
view.enableAutoRepaint();
sleep(3000);
}
}
int playPetFunc(string sLastPressedItemName){
openThread(walkAnimationFunc);
return 1;
}
//view.onItemFocused(playPetFunc,"start")
//view.setFocus("start");
//view.onItem(playPetFunc, "play");
openThread(walkAnimationFunc);
