duck

duck

Jul 2nd, 2010
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1.  
  2.  
  3.  
  4. var wasSnapped : boolean;
  5.  
  6. function Update() {
  7.  
  8. snap = false;
  9.  
  10. for (snapPos in snapPositions) {
  11. (if touch is near snapPos) {
  12. snap = true;
  13. foundSnapPosition = snapPos;
  14. }
  15. }
  16.  
  17. if (snap) {
  18.  
  19. if (!wasSnapped) {
  20.  
  21. // this is the first frame of a snap!
  22. send foundSnapPosition
  23. wasSnapped = true
  24. }
  25.  
  26. } else {
  27.  
  28. send touch position
  29. wasSnapped = false
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment