The planet surface image has a position where the object is safe to land. If the object lands anywhere else on that image, a JMessagePane will show that the mission has failed.
This is the code I Have allready which stops the object leaving the pane its held within:
public void run() {
jPanel1.requestFocus();
x = (int) p.getX();
y = (int) p.getY();
while (true) {
lblShip.setLocation(x, y);
y += sldSpeed.getValue();
if (x > 670){
x = 670;
}
if (y > 450){
y = 450;
}
if (x < 0){
x = 0;
}
try{
Thread.sleep(100);
} catch (InterruptedException e){
}
Is there anyway that the object can have a preset landing area?
Anywhere else which it lands on the image will give a JMessagePane telling the player the mission has failed.

New Topic/Question
Reply


MultiQuote



|