How would I make my character (link) bigger?

float x;
float y;
PImage linkUp;
PImage linkDown;
PImage linkLeft;
PImage linkRight;
PImage current;


void setup () {
  size(1000, 800);
  linkUp = loadImage("link_Up.png");
  linkDown = loadImage("link_Down_Shield.png");
  current = loadImage("link_Down_Shield.png");
  linkLeft = loadImage("link_Left_Shield.png");
  linkRight = loadImage("link_Right_Shield.png");
  x = 50;
  y = 100;
}


void draw () {
  background(0);
  image(current, x, y);
}


void keyPressed() {

  if ( key == CODED) {
    if ( keyCode == UP) {
      current = linkUp;
      y = y - 10;
    }
    if ( keyCode == DOWN) {
      current = linkDown;
      y = y + 10;
    }
    if ( keyCode == LEFT) {
      current = linkLeft;
      x = x - 10;
    }
    if ( keyCode == RIGHT) {
      current = linkRight;
      x = x + 10;
    }
  }
}
Tagged:

Answers

  • Alternatively, use the version of image () with 5 parameters.

    Both these methods require additional runtime processing. I'd prefer to resize the image outside of processing and use those bigger images instead.

  • Answer ✓

    use resize in setup, but never in draw. It's too slow.

    Don't use the version of image() with 5 parameters. It's too slow.

    I'd prefer to resize the image outside of processing and use those bigger images instead.

Sign In or Register to comment.