Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //*BASIC VARIABLES*
- int x;
- int y;
- float lastx = 1.05;
- float lasty = 1.05;
- int xPos = 1;
- int yPos = 1;
- int DrawFactor = 1;
- Float ColourR = (random(256));
- Float ColourG = (random(256));
- Float ColourB = (random(256));
- void setup() {
- size(500,500);
- background(255);
- }
- void draw() {
- //*ENVIRONMENT/UI SETTINGS*
- cursor(CROSS);
- stroke(ColourR,ColourG,ColourB);
- fill (ColourR,ColourG,ColourB);
- rect (400, 400, 55, 55);
- //*COLOUR COMMAND*
- if(keyPressed){
- if(key == 'C' || key == 'c'){
- ColourR = (random(256));
- ColourG = (random(256));
- ColourB = (random(256));
- }
- }
- //*RESET COMMAND*
- if(keyPressed){
- if(key == 'r'){
- x = 0;
- y = 0;
- lastx = 0;
- lasty = 0;
- background(255);
- }
- }
- //*MOVEMENT COMMANDS*
- if(keyPressed) {
- if(key == 'a' || key == 'A'){
- x++;
- y++;
- lastx++;
- lasty++;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(key == 's' || key == 'S'){
- x++;
- y--;
- lastx++;
- lasty--;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(key == 'w' || key == 'W'){
- x--;
- y++;
- lastx--;
- lasty++;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(key == 'd' || key == 'D'){
- x--;
- y--;
- lastx--;
- lasty--;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- else if(key == CODED){
- if(keyCode == UP) {
- y--;
- lasty--;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(keyCode == LEFT) {
- x--;
- lastx--;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(keyCode == DOWN) {
- y++;
- lasty++;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- if(keyCode == RIGHT) {
- x++;
- lastx++;
- if (DrawFactor == 1) {
- line(lastx, lasty, x, y);
- }
- }
- }
- }
- //*PEN SIZE COMMANDS*
- if(keyPressed){
- if(key == '=' || key == '+'){
- lastx = lastx + 0.25;
- lasty = lasty + 0.25;
- }
- }
- if(keyPressed){
- if(key == '-' || key == '_'){
- lastx = lastx - 0.25;
- lasty = lasty - 0.25;
- }
- }
- //*DRAW MODE COMMANDS*
- if(keyPressed){
- if(key == '[' || key == '{'){
- DrawFactor = 0;
- }
- }
- if(keyPressed){
- if(key == ']' || key == '}'){
- DrawFactor = 1;
- }
- }
- }
- //*START POINT SELECTION*
- void mouseClicked(){
- x = mouseX;
- y = mouseY;
- lastx = mouseX +1;
- lasty = mouseY +1;
- }
- //*JUNK CODE/NOTES*
- //
- //
- //In memory of Ross, YOU WILL BE MISSED
- //06-10-2010
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement