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

2014/10/12

Need help displaying variable

ILOVELABRADORS ILOVELABRADORS

2014/10/12

#
Hi guys. I really don't get how to display the total amount of degrees an actor has turned. My actor turns while it's moving around, so if every time it turns, it turns 6 degrees, and when it turns of the wall, it turns 120 degrees, how to you add all of that up and display it on the screen? PS. Sorry, I'm not that good at displaying text on the screen, especially when you have to update it. Any help would be appreciated, as I'm really stuck. :/
NikZ NikZ

2014/10/12

#
World.showText(), or GreenfootImage.drawString() should do it. To update it, use Actor.act().
danpost danpost

2014/10/12

#
If you have the latest version of Greenfoot (2.4), the World class method 'showText', which NikZ suggested, should work. However, you have no easy way to control how the text is displayed. Using an Actor object to display the text is more versatile; and it is easier to use the GreenfootImage constructor that creates a text image than creating a blank GreenfootImage and using the 'drawString' method -- especially if you wanted to change the font size or the colors.
ILOVELABRADORS ILOVELABRADORS

2014/10/17

#
Sorry for the late reply, I don't have version 2.4; I only have version 2.3. Do those methods work for 2.3 as well? Thank you very much for your replies. I might not be able to check a lot, because I am busy inn weekdays.
ILOVELABRADORS ILOVELABRADORS

2014/10/17

#
By the way, can you please give me some examples of World.showText() and GreenfootImage.drawString()? And also, could you explain how to use Actor.act? Thanks. :D
ILOVELABRADORS ILOVELABRADORS

2014/10/18

#
I don't really understand how you're supposed to use GreenfootImage.drawString or World.showText. Can somebody help?
Alwin_Gerrits Alwin_Gerrits

2014/10/18

#
maybe this will help? greenfoot topic drawstring
ILOVELABRADORS ILOVELABRADORS

2014/10/19

#
Thanks i'll try...
ILOVELABRADORS ILOVELABRADORS

2014/10/19

#
Thanks, but do you know how to update it? Because what I am trying ti do is to record how many degrees it has turned in all. Thanks for your help, though.
Super_Hippo Super_Hippo

2014/10/19

#
If you want to update it, you could create a method which you call when it is created and every time the value changed.
ILOVELABRADORS ILOVELABRADORS

2014/11/27

#
It's a bit too late to reply, but thanks a bunch
You need to login to post a reply.