Hi i'm trying this code but it tells me: java.lang.IllegalArgumentException : bound must be positive...
It's at line 29.. I want to get a randomNumber from 0 to i, I don't see how it could be negative. Thank you for helping^^
import greenfoot.*;
import java.awt.Color;
public class Deformator extends SmoothMover
{
Color [][] pixels = new Color[140][50];
private int counter;
GreenfootImage deformation = new GreenfootImage(140, 50);
public Deformator()
{
counter = 0;
}
public void act()
{
movements();
for(int i = 0; i<140 ; i++)
{
for (int j = 0; j<50; j++)
{
pixels [i][j] = getWorld().getColorAt(this.getX()-70+i, this.getY()-25+j);
}
}
for(int i = 0; i<140 ; i++)
{
for (int j = 0; j<50; j++)
{
deformation.setColorAt(139-i, 49-j, pixels[Greenfoot.getRandomNumber(i)][j]);
setImage(deformation);
}
}
}
public void movements()
{
if(this.getX()>70)
{
move(-1);
}
}
}

