# How do I make an entity move once per second in crafty.js

I am trying to implement "Snake" using crafty.js but I can't seem to get the snake entity to move just once in a second. How do I do this?

You could use the timeout method from Crafty core functions.

First argument is the function to be executed, second argument is the time in miliseconds

Crafty.c("Snake",{
init: ...
move: function() {
//code for movement
this.timeout(move, 1000);
}
});


or you can pass an anonymus function as argument

this.timeout(function() {
//code code coode
}, 1000);


Sorry if i my English is bad

• I must have missed this in the documentation. Thank you for pointing it out. – gnerkus Apr 17 '13 at 0:38