# How I could resizes the object for character for a game

**URL:** https://discourse.processing.org/t/how-i-could-resizes-the-object-for-character-for-a-game/40502
**Category:** Coding Questions
**Tags:** homework
**Created:** [January 7, 2023, 10:25pm UTC](https://discourse.processing.org/t/how-i-could-resizes-the-object-for-character-for-a-game/40502 "2023-01-07T22:25:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kayiist](https://avatars.discourse-cdn.com/v4/letter/k/7ea924/32.png) [@kayiist](https://discourse.processing.org/u/kayiist)
#### Post date: [January 7, 2023, 10:25pm UTC](https://discourse.processing.org/t/how-i-could-resizes-the-object-for-character-for-a-game/40502/1 "2023-01-07T22:25:58Z")

</div>

![pict](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/3/6/3670fde0462b41ae37a467a3a10c1bc25a92f1a1.jpeg)

```auto
float x = 200;
float y = 200;
int[] pipeX, pipeY; //Declaring

void setup()
{
  size(800, 620);
  bg =loadImage("bg.jpg");
  top_pipes = loadImage("top.png");
  bottom_pipes = loadImage("bottom.png");
  pipeX = new int [4];
  pipeY = new int[pipeX.length];
  //Populate array with values
  for (int i = 0; i < pipeX.length; i++)
  {
   pipeX[i] = width + 200*i;
   pipeY[i] = (int) random (-350, 50); //float to int
  }
}

void draw()
{
 setBg();
 cleo();
  for (int i = 0; i < pipeX.length; i++)
  {
    image(top_pipes, pipeX[i], pipeY[i]);
    image(bottom_pipes, pipeX[i], pipeY[i] + 680);
    pipeX[i]--;
  }
}

```

---

<div class="post-metadata">

### Author: ![Mikey83](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mikey83/32/17956_2.png) [@Mikey83](https://discourse.processing.org/u/Mikey83)
#### Post date: [January 8, 2023, 3:32am UTC](https://discourse.processing.org/t/how-i-could-resizes-the-object-for-character-for-a-game/40502/2 "2023-01-08T03:32:57Z")

</div>

There’s two ways of doing this, one is to use 2 more parameters in the image() function.

```auto
image(top_pipes, pipeX[i], pipeY[i], 100,100); // will make it 100 by 100 pixels

```

The other method is to use the resize function in setup.

```auto
top_pipes.resize(100,100);

```

They both do the same thing and as far as I can tell one has no advantage over the other, Hope that helps
