Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. //*BASIC VARIABLES*
  2. int x;
  3. int y;
  4. float lastx = 1.05;
  5. float lasty = 1.05;
  6. int xPos = 1;
  7. int yPos = 1;
  8. int DrawFactor = 1;
  9. Float ColourR = (random(256));
  10. Float ColourG = (random(256));
  11. Float ColourB = (random(256));
  12.  
  13.  
  14. void setup() {
  15. size(500,500);
  16. background(255);
  17. }
  18.  
  19.  
  20.  
  21. void draw() {
  22.  
  23. //*ENVIRONMENT/UI SETTINGS*
  24. cursor(CROSS);
  25. stroke(ColourR,ColourG,ColourB);
  26. fill (ColourR,ColourG,ColourB);
  27. rect (400, 400, 55, 55);
  28.  
  29.  
  30. //*COLOUR COMMAND*
  31. if(keyPressed){
  32. if(key == 'C' || key == 'c'){
  33. ColourR = (random(256));
  34. ColourG = (random(256));
  35. ColourB = (random(256));
  36. }
  37. }
  38.  
  39.  
  40. //*RESET COMMAND*
  41. if(keyPressed){
  42. if(key == 'r'){
  43. x = 0;
  44. y = 0;
  45. lastx = 0;
  46. lasty = 0;
  47. background(255);
  48. }
  49. }
  50.  
  51.  
  52. //*MOVEMENT COMMANDS*
  53. if(keyPressed) {
  54.  
  55. if(key == 'a' || key == 'A'){
  56. x++;
  57. y++;
  58. lastx++;
  59. lasty++;
  60. if (DrawFactor == 1) {
  61. line(lastx, lasty, x, y);
  62. }
  63. }
  64.  
  65. if(key == 's' || key == 'S'){
  66. x++;
  67. y--;
  68. lastx++;
  69. lasty--;
  70. if (DrawFactor == 1) {
  71. line(lastx, lasty, x, y);
  72. }
  73. }
  74. if(key == 'w' || key == 'W'){
  75. x--;
  76. y++;
  77. lastx--;
  78. lasty++;
  79. if (DrawFactor == 1) {
  80. line(lastx, lasty, x, y);
  81. }
  82. }
  83.  
  84. if(key == 'd' || key == 'D'){
  85. x--;
  86. y--;
  87. lastx--;
  88. lasty--;
  89. if (DrawFactor == 1) {
  90. line(lastx, lasty, x, y);
  91. }
  92. }
  93.  
  94.  
  95.  
  96. else if(key == CODED){
  97.  
  98. if(keyCode == UP) {
  99. y--;
  100. lasty--;
  101. if (DrawFactor == 1) {
  102. line(lastx, lasty, x, y);
  103. }
  104. }
  105.  
  106.  
  107. if(keyCode == LEFT) {
  108. x--;
  109. lastx--;
  110. if (DrawFactor == 1) {
  111. line(lastx, lasty, x, y);
  112. }
  113. }
  114.  
  115. if(keyCode == DOWN) {
  116. y++;
  117. lasty++;
  118. if (DrawFactor == 1) {
  119. line(lastx, lasty, x, y);
  120. }
  121. }
  122. if(keyCode == RIGHT) {
  123. x++;
  124. lastx++;
  125. if (DrawFactor == 1) {
  126. line(lastx, lasty, x, y);
  127. }
  128. }
  129. }
  130. }
  131.  
  132.  
  133. //*PEN SIZE COMMANDS*
  134. if(keyPressed){
  135. if(key == '=' || key == '+'){
  136. lastx = lastx + 0.25;
  137. lasty = lasty + 0.25;
  138. }
  139. }
  140. if(keyPressed){
  141. if(key == '-' || key == '_'){
  142. lastx = lastx - 0.25;
  143. lasty = lasty - 0.25;
  144. }
  145. }
  146.  
  147.  
  148. //*DRAW MODE COMMANDS*
  149. if(keyPressed){
  150. if(key == '[' || key == '{'){
  151. DrawFactor = 0;
  152. }
  153. }
  154. if(keyPressed){
  155. if(key == ']' || key == '}'){
  156. DrawFactor = 1;
  157. }
  158. }
  159. }
  160.  
  161.  
  162. //*START POINT SELECTION*
  163. void mouseClicked(){
  164. x = mouseX;
  165. y = mouseY;
  166. lastx = mouseX +1;
  167. lasty = mouseY +1;
  168. }
  169.  
  170.  
  171. //*JUNK CODE/NOTES*
  172. //
  173. //
  174. //In memory of Ross, YOU WILL BE MISSED
  175. //06-10-2010
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement