I am trying to find out how to make an orbiting object stay static
Start:
<- orbiting object
then while orbiting
<- orbiting object
So far I only got this
_
_ <- the orbiting object rotate 90 degress
How to make the object (in my case a planet image) static and not rotating?
and in one of the planets
import greenfoot.*;
/**
* Write a description of class world here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class world extends World
{
private GreenfootSound backgroundmusic = new GreenfootSound("music.mp3");
public world()
{
super(3515, 2154, 1);
prepare();
}
public void started()
{
backgroundmusic.playLoop();
}
private void prepare()
{
// Add your constructor code here.
title title = new title();
sun sun = new sun();
mercury mercury = new mercury();
venus venus = new venus();
earth earth = new earth();
moon moon = new moon();
mars mars = new mars();
jupiter jupiter = new jupiter();
saturn saturn = new saturn();
uranus uranus = new uranus();
neptune neptune = new neptune();
asteroid_belt asteroid_belt = new asteroid_belt();
ceres ceres = new ceres();
vesta vesta = new vesta();
// Add your object code here.
addObject(title, 471, 179);
addObject(sun, 1758, 1077);
addObject(mercury, 0, 0);
addObject(venus, 0, 0);
addObject(earth, 0, 0);
addObject(mars, 0, 0);
addObject(asteroid_belt, 0, 0);
addObject(jupiter, 0, 0);
addObject(saturn, 0, 0);
addObject(uranus, 0, 0);
addObject(neptune, 0, 0);
// Add your position code here.
mercury.setRotation(0);
venus.setRotation(0);
earth.setRotation(0);
mars.setRotation(0);
jupiter.setRotation(0);
saturn.setRotation(0);
uranus.setRotation(0);
neptune.setRotation(0);
vesta.setRotation(0);
ceres.setRotation(0);
// Add your action code here.
mercury.act();
venus.act();
earth.act();
mars.act();
asteroid_belt.act();
jupiter.act();
saturn.act();
uranus.act();
neptune.act();
}
}
import greenfoot.*;
/**
* Write a description of class mercury here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class mercury extends Actor
{
int radius = 210;
int rotational_speed = 1;
boolean MouseHover = false;
/**
* Act - do whatever the mercury wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation((getWorld().getWidth()/2), (getWorld().getHeight()/2));
turn(rotational_speed);
move(radius);
if(!MouseHover && Greenfoot.mouseMoved(this))
{
MouseHover = true; // don't mind these, I'm planning to show a statistic card when user hover on the planet
}
if (MouseHover && Greenfoot.mouseMoved(null) && ! Greenfoot.mouseMoved(this))
{
MouseHover = false;
}
}
}
