This site requires JavaScript, please enable it in your browser!
Greenfoot back
Zakki1
Zakki1 wrote ...

2016/4/6

Instruction

Zakki1 Zakki1

2016/4/6

#
How to i add a image in as instruction? Also I made a Rocket game and i need to add levels and I want to make asteroid faster as you reach higher and and higher score? Help me please thanks in advanced
Super_Hippo Super_Hippo

2016/4/6

#
Do you already have the image or do you need support in how to create the image? If you already have one, you can set it as the background of the world or let an actor use that image and add it to the world. For the asteroids, it could look like this:
//in Asteroid class
public static int speed = 5;

public void act()
{
    move(speed);
}
//Rocket class or any other class which has the score variable

//when increasing the score, example:
if (score == 100) Asteroid.speed = 6;
else if (score == 200) Asteroid.speed = 7;
else if (score == 300) Asteroid.speed = 8;
Because 'speed' is static, you need this in the world constructor to reset it:
Asteroid.speed = 5;
Zakki1 Zakki1

2016/4/6

#
I already have the picture as actor, I just need to stay there and when you click any button it disappear. Thx
Super_Hippo Super_Hippo

2016/4/7

#
To make it disappear from another class, you can use this:
Actor instruction = (Actor) getWorld().getObject(Instruction.class).get(0);
if (instruction != null) getWorld().removeObject(instruction);
You need to login to post a reply.