Hello, i'm actually doing a project for my school where i have to create mazes with mouse. Then I have different level of maze and differents mouse who are more or less 'intelligent'.
So, the user can choose the level and mouse ; then, in order to show some statistics i need a score table. To do that, i have a timer, but i don't know how to send the result of the timer in my tab ; i have read things about userInfo and stuff but i don't really understant how can i sent more than one value.
(Sorry for my english by the way)!
This is how my timer and tab is implemented :
So, in this tab which looks like a matrix, i would like to send all my timer's stat into it.
Thanks :)!
public class Score extends Actor
{
int aLevel, aIntel;
int scoreTab[][] = new int[7][6];
Button menu = new Button("menu.png");
/**
* Act - do whatever the Score wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
public Score()
{
updateScore();
}
public void setScore(final int time, final int pLevel, final int pIntel)
{
scoreTab[pLevel][pIntel] = time;
updateScore();
}
private void updateScore()
{
GreenfootImage image = new GreenfootImage(1100, 600);
image.fill();
GreenfootImage title = new GreenfootImage("Tableau des temps", 50, Color.white, new Color(0, 0, 0, 0));
image.drawImage(title, 350, 50);
for(int i=0;i<7;i++)
{
if(i>0)scoreTab[i][0] = i;
for (int j=0;j<6;j++)
{
if(j>0)scoreTab[0][j] = j;
if(i != 0 || j != 0)
{
GreenfootImage textImage = new GreenfootImage(scoreTab[i][j]+"", 40, Color.white, new Color(0, 0, 0, 0));
image.drawImage(textImage, ((2*i+1)*75), (2*j+1)*30+150);
setImage(image);
}
}
}
}
}
