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

Hissss's Comments

Back to Hissss's profile

Thank you! The project is sadly due today, so I cannot really explore too much more in your UI, but there is a very good chance I will come back to it later because I'm actually really proud of this one. It's my first knock-off lol.
Thank you, it works like a charm!
I understand the folder packaging and the importing, but am having trouble actually getting it to instantiate on the screen. I'll go ahead and copy paste my usual code over to form a title image and hope you can help me from there. I have since deleted the original code I used to try and instantiate the fancy screen, but all I need are two buttons if you can help me out. The code I pasted is used to handle switching between rooms in the game I am making if that helps. import greenfoot.*; /** * This class is used to initialize and control changing of worlds */ public class ControlWorld extends World { static Actor kara; // an actor to be passed from world to world Portal portalLeft, portalRight, portalUp, portalDown; Actor btnExit, btnStart; /** * This initial world constructor starts the control of changing worlds for the rooms. */ public ControlWorld() { super(800, 600, 1); kara = new Kara(); String text = "\nAlex His APCSA Project"; GreenfootImage img = new GreenfootImage(text, 40, Color.BLACK, new Color(0, 0, 0, 0)); getBackground().drawImage(img, 400-img.getWidth()/2, 150); } public void act() { World world = new Room1(); world.addObject(kara, getWidth()/2, getHeight()/2); Greenfoot.setWorld(world); } /** * This continuation constructor is used to go from one world to the next. * * @param wide the width of the new world (in cells) * @param high the height of the new world (in cells) * @param cellsize the size of a single cell in the new world (in pixels) */ public ControlWorld(int wide, int high, int cellsize) { super(wide, high, cellsize); } }
This is my first time trying to import a whole new class like this and I'm not sure how to do it. Can you help me out? I've tried numerous things for over an hour and just can't quite get it. What I'm trying to do is stitch this together with my project as an overlay that gets called automatically, but it keeps competing with the world that I already have and really have no clue. Do I have to redo all my classes under this one so they are called correctly?