Advertisement
Guest User

fdg

a guest
May 28th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. int x = 200;
  2. int y = 0;
  3. int planeDirection = 0;
  4.  
  5.  
  6.  
  7. void setup() {
  8. size(512, 768);
  9. }
  10.  
  11. void Movement() {
  12. if (key == CODED) {
  13. if (keyCode == LEFT) {
  14. planeDirection -= 1;
  15. }
  16. if (keyCode == RIGHT) {
  17. planeDirection += 1;
  18. }
  19. }
  20. }
  21.  
  22. void draw() {
  23. drawBackground();
  24. Movement();
  25. if (planeDirection == 0) {
  26. drawSouth();
  27. }
  28. if (planeDirection == -1) {
  29. drawSouthWest();
  30. }
  31. if (planeDirection == -2) {
  32. drawWest();
  33. }
  34. if (planeDirection == +1) {
  35. drawSouthEast();
  36. }
  37. if (planeDirection == +2) {
  38. drawEast();
  39. }
  40. }
  41.  
  42. void drawSouth() {
  43. y+=4;
  44. triangle(x - 10, y - 10, x + 10, y - 10, x, y + 10);
  45. }
  46.  
  47. void drawSouthWest() {
  48. y+=3;
  49. x-=1;
  50. triangle(x, y - 10, x + 10, y + 2, x - 8, y + 8);
  51. }
  52.  
  53. void drawWest() {
  54. y+=2;
  55. x-=2;
  56. triangle(x+10, y-10, x+10, y+10, x-10, y);
  57. }
  58.  
  59. void drawSouthEast() {
  60. y+=3;
  61. x+=3;
  62. triangle(x, y - 10, x - 10, y + 4, x + 8, y + 8);
  63. }
  64. void drawEast() {
  65. y+=2;
  66. x+=2;
  67. triangle(x-10, y-10, x-10, y+10, x+10, y);
  68. }
  69.  
  70. void drawBackground() {
  71. background(80, 60, 20);
  72. stroke(120, 120, 0);
  73. for (int Pineapple = 15; Pineapple < height; Pineapple += 15) {
  74. line(0, Pineapple, width, Pineapple);
  75. }
  76. for (int lineY = 0; lineY < height; lineY += 30) {
  77. for (int lineX = 0; lineX < width; lineX += 35) {
  78. line(lineX, lineY, lineX, lineY+15);
  79. line(lineX +15, lineY +15, lineX +15, lineY +30);
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement