Learn Create Your Own Split Screen

Next Page

One option is be to make a function that causes the next costume to be selected.
function Make_kid_switch_to_next_costume() { kid.costume++; if (kid.costume > 4) kid.costume= 0; }
We could call this function from a timer every 125ms:
setInterval(Make_kid_switch_to_next_costume, 125);

 


 

It works pretty well !

Try changing the code below to make the kid walk faster or slower.