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

What is happening right now?


reply to Adding clock

By danpost - 9 minutes ago
Ankit_Thapa wrote...
Basically I want to start the timer whenever the user press the run button. I want to display the timer till the game ends
"Basically" is not enough. You need to be detailed and explicit; and provide all aspects of how you want it.

reply to can i use getOneIntersectingObject for a object of a class in world instead of the class itself?

By danpost - about 11 hours ago
Rayray wrote...
could you provide example code of these?
Method 3 would probably be easiest. When you create and add the pads into the world, rotate them in the direction you want the car to turn when it gets to them. The cars may also need to keep track as to which pad they are currently at; and you may need to use a boolean to indicate whether the turn at that pad was made yet or not. It all depends on the size relationships between the intersection and pad and where the car will be turning in relation to them. Providing example code is quite impossible without going over pretty much all you have already (both codes and images). At any rate, simply put, without regard to exactly when the car should turn; but, just to get the direction to turn from the pad if the pad is rotation at the time it is added into the world (using 'Pad' as the class of the detector): <Code Omitted>Hope this makes some sense.

reply to how to stop car actors if there is already a car actor moving through a crossroad

By danpost - about 12 hours ago
Not easily. You may want to look at the code of my Traffic Control scenario. Just run it and click on the buttons along the bottom within the scenario.