Hello everyone! So I have a problem which I can't seem to be able to sort out by myself.
You see, I made a game some time ago, and I want to fix it now.
Here's the thing. There is a timer (calendar actually) and when day 8 arrives I want the game to display a banner with Election Day and then that banner to disappear. I've also added a skip button, so when pressed the day reaches 8 and the election comes so the banner should appear. This is the piece of code. I created an object named ElecDay with that banner as the image, and here's what's happening:
and here is the code in the world editor:
Now, what's happening: the game seems to freeze according to the delay, but the static image doesn't change even though I wrote the command before. It freezes, then the static image changes and simultaneously the banner appears, then immediately disappears, then the banner appears, freezes according to that second delay and then disappears. What should I do to make it work? Thank you in advance!
Paul
skip skip=((Harta)getWorld()).getSkip();
if (Greenfoot.mouseClicked(skip))
{
i=8;
setImage(new GreenfootImage(i+" NOV "+ "2016",18, Color.BLACK, Color.WHITE));
j=3;
Greenfoot.delay(240);
elecDay elecDay=((Harta)getWorld()).getelecDay();
getWorld().addObject(elecDay,600,150);
Greenfoot.delay(20);
getWorld().removeObject(elecDay);
safetycontrol=false;
}private elecDay elecDay=new elecDay();
private skip skip=new skip();
.
.
.
public elecDay getelecDay()
{
return elecDay;
}
public skip getSkip()
{
return skip;
}