Advertisement
Guest User

hj

a guest
Feb 22nd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. var pionek = function() {
  2. fill(255, 0, 0);
  3. rect(x,y,10,10);
  4. if (keyIsPressed && keyCode === LEFT) {
  5. x = x - 1;
  6. }
  7. if (keyIsPressed && keyCode === RIGHT) {
  8. x = x + 1;
  9. }
  10. if(keyIsPressed && keyCode === UP&&y>162) {
  11. y = y - 1;
  12. }
  13. if(keyIsPressed && keyCode === DOWN) {
  14. y = y + 1;
  15. }
  16.  
  17. if (x+10 === 10 && y+10 === 50) {
  18. x = 0 ;
  19. }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement