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

2019/8/29

How to add own image as Background?

Timb Timb

2019/8/29

#
Hi im new to Greenfoot and was wondering how I can use an image as a Background. When I create a new world class I can select an image but it doesnt appear in the world. It just says "Instantiate a new World object.
danpost danpost

2019/8/29

#
Timb wrote...
Hi im new to Greenfoot and was wondering how I can use an image as a Background. When I create a new world class I can select an image but it doesnt appear in the world. It just says "Instantiate a new World object.
What kind of image is it? Is it located in the images folder of that scenario's folder?
Timb Timb

2019/8/30

#
Yes. Its a normal png
danpost danpost

2019/8/30

#
Timb wrote...
Yes. Its a normal png
Please provide your entire class codes for your World subclass.
Proprogrammer04 Proprogrammer04

2019/9/3

#
As @danpost said, I dont know your Code, but the general code for adding an image to your background is this:
GreenfootImage background=new GreenfootImage("yourImage.png");
setBackground(background);
Ohr it should be, I am writing this in my mobilephone, and cant test it... Im not surfe if there hast to be something like
Greenfoot.setBackground(...);
Or something similar, but you will just have to try out...
You need to login to post a reply.