which one the right order??

man…i got confuse :-/
show me the right order plzz…
is it like this??


while (running) {
detectKeyboard();
drawAllSprites();

for (int i=0;i < all;i++) {
  // updateSprites();
  updateStatus();
  spriteCollision(i, i+1); // check for collision sprite i to all below i
  updateVelocity();
  updatePicture();
}
}

please tell me what should i do in every phase
i got lost here… :’(
(my sprite collision very bad…sometimes the collision not occur, when the player push npc, the npc break through house, tree, all object ??? )