I want to have all my fireworks (yes, I am creating a scenario that just shoots fireworks) have a velocity between 10.0 and 15.0 yet include all decimals to a tenth. How can I do so
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; public class Rocket extends SmoothMover { Color randomColor = new Color(Greenfoot.getRandomNumber( 255 ), Greenfoot.getRandomNumber( 255 ), Greenfoot.getRandomNumber( 255 ), 255 ); private int Direction = Greenfoot.getRandomNumber( 40 )+ 210 ; public Rocket() { setRotation(Direction); GreenfootImage image; image = new GreenfootImage( 10 , 10 ); image.setColor(randomColor); image.drawOval( 0 , 0 , 10 , 10 ); image.fillOval( 0 , 0 , 10 , 10 ); setImage(image); } public void act() { // Add your action code here. } } |