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

Comments for star scrolling

Return to star scrolling

A new version of this scenario was uploaded on Mon Oct 29 20:19:01 UTC 2012
Hi, My questions: Why your stars move without pressing they "play" button and why I can't "Reset" that?
danpostdanpost

2012/10/29

@hkrhasleholm, Greenfoot has as command that will start the scenario from the world constructor. And resetting does work, but again starts the scenario and it is very hard (at least in this scenario) to tell that it actually was reset.
lonely.girllonely.girl

2012/10/30

Great job This is so awesome, can u plz tell me if there is a possibility to make the stars divided randomly into space ??? I tried the following code but it didn't change it the way I wanted it to getImage(). fillOval(x,y,2,2);
erdelferdelf

2012/10/30

addObject(stars[i], Greenfoot.getRandomNumber(getWidth()), getHeight()/2); this command is three times in the world class. you have to change the getHeight()/2 to Greenfoot.getRandomNumber(getHeight())
lonely.girllonely.girl

2012/10/30

Thank you so much, you are a life saver, that was awesome I don't know how didn't I think about it :( I'm starting to doubt my choice to be a programmer :s
lonely.girllonely.girl

2012/10/30

Just one last question, how to do the following: to call the move method from the world class?
Gevater_Tod4711Gevater_Tod4711

2012/10/30

you need a reference to the object in which you want to execute the move method and then call the method like this: reference.move();
lonely.girllonely.girl

2012/10/30

so I put both the act and move method in the world then call it as you mentioned in the actor???
erdelferdelf

2012/10/30

put this in the world class: public void act() { for(int i = 0; i < 100; i++) { stars[i].move(); } } and remove the move(); line in the star class in the act method
A new version of this scenario was uploaded on Tue Oct 30 18:17:20 UTC 2012
erdelferdelf

2012/10/30

just download the update, I changed the code so it is calling the move method from the world
lonely.girllonely.girl

2012/10/30

I did it but now the screen is black and only a few stars moving at the upper edge of the world :(
erdelferdelf

2012/10/30

yeah, I forgot a bug, download the latest update here
lonely.girllonely.girl

2012/10/30

I have to finish this tonight, plz any ideas??? !!! :(
SPowerSPower

2012/10/30

@lonely.girl Please create a new discussion for this, then it's easier for other people to help you :)
lonely.girllonely.girl

2012/10/30

This was a huge help, thanks a million for your efforts, I really appreciate it :)
erdelferdelf

2012/10/30

@lonely.girl, I dont know if you read what I wrote but I uploaded an update, try it with this one
erdelferdelf

2012/10/30

we wrote at the same time ...
lonely.girllonely.girl

2012/10/30

@erdelf Yes I read what your wrote put we both posted at the same time, I checked what you uploaded it was only with the update location method. @SPower: everything is fine now, thanks for your advice and sorry for bothering :s