im just programming a game and before the game starts i have an image which should close after i press "enter".
i know this is a silly question but every code i type in is wrong :/. thanks for help
Where is this image: is it a world background or an Actor image? is it set as the default image for where it is used? When 'closing' the image, are you changing worlds? These are questions that would help to determine how to code what you want to do; including information on what is replacing the image, if that applies.
its an actor class, when it closes the user can see the game. the image/actor class is in the world like all the other objects, but it looks like a mainmenu and when i press enter i want nothing to happen but emoving that image, thanks.
The image belongs to the actor. If you remove the actor, the image goes too. Use the World class method 'removeObject' or 'removeObjects'. You may be able to use the World class method 'getObjects' to list the ones to remove.
yeah thanks alot, it works. but now i have another little problem. when i press space i want it to open a subclass.
apparently its not working :/. could you tell me the code to open a new class?
if (Greenfoot.isKeyDown("space"))
{
???
}
okay, before the game starts there is this mainmenu(whis is just a image), when i press enter it closes and the game starts. but there should be an option to read the instructions. thats why i created another layout, a subclass of the mainmenu, which should open after i press the space button.
I am not too sure that you want it to be a subclass of mainmenu or just a subclass of Actor. Anyway, to add an actor into the world, use the World class method 'addObject'.