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

RcCookie's Comments

Back to RcCookie's profile

Thanks! I have to fix the text rendering though, its taller when online. That's why it cut's the bottom of
If you want to see the full error you may want to increase the world size. These errors are caused by the not so good java to JavaScript converter btw
RcCookieRcCookie

2020/12/15

Thanks a lot!
Thanks! Happy you like it!
By the way, if you want your text to have the same design as the buttons, you can use the Text class. For example: addObject(new Text("\nAlex His APCSA Project", 40), 400, 150); would replace your title drawing in the constructor. Text is in rccookie.greenfoot.ui.basic;
Great!
Say you want to switch between worlds with a button. Then all you need is something like this in the constructor: addObject(new TextButton(„Switch world“).addClickAction(m -> Greenfoot.setWorld(new SecondWorld())), 300, 350); This will initialize and set a new world named SecondWorld
No, this is based on java packaging. This is basically like a folder system. Therefore, copy the whole „rccookie“ folder into your project, so that the structure is like YourScenarioFolder |-images |-rccookie |-MyWorld.java |-MyWorld.class |-project.greenfoot |-More of your classes Then you can import a class from the package like this: // At the very top of the file just like the greenfoot import import rccookie.ui.basic.Button; This way you import the Button class. You can also write import rccookie.ui.basic.*; import rccookie.zu.advanced.*; import rccookie.ui.util.*; To import absolutely everything about the ui. Actually the import greenfoot.*; statement works exactly the same, only that is does not reference a folder in your scenario‘s folder. You can also take a look into the MyWorld source code in my demo to see how I did this.
And for the time: Try java.util.Calendar.getInstance().get(Calendar.HOUR_OF_DAY) and MINUTE