I was taking an HTML5 Game Development course and saw a neat trick for wrapping at the end of a sequence:
index = index + 1 % array.length;
index++ if (index > array.length) { index = 0; }
No comments:
Post a Comment