ok i have created a method to movea number of objects, but i want to move all of them at the same time(balloons flying is what im aimining for,lol)but they move seperatly?

/**
  * Create method for balloons to fly
  */

 public void slowMoveVertical()

{
    top.slowMoveVertical(-50);
    top2.slowMoveVertical(-50);
    top3.slowMoveVertical(-50);
    middle.slowMoveVertical(-50);
    middle2.slowMoveVertical(-50);
    middle3.slowMoveVertical(-50);
    bottom.slowMoveVertical(-50); 
    bottom2.slowMoveVertical(-50);
    bottom3.slowMoveVertical(-50);
 }

Recommended Answers

All 13 Replies

threads

Given that you haven't posted what the slowMoveVertical(int) method you are calling on each does, how could we possibly say?

alrite lad, calm it.just ask nicely and i shall.

A general suggestion would be to encapsulate postional info in the objects, put the code to update positions in one method, and the code that renders them in another.

/**
 * draw a balloon on to a canvas
 * 
 * @author (chris twaits) 
 * @version (12/10/07)
 */
public class Balloons
{
    private Circle top;
	private Triangle middle;
    private Triangle bottom;
	private Circle top2;
	private Triangle middle2;
    private Triangle bottom2;
    private Circle top3;
	private Triangle middle3;
    private Triangle bottom3;
    
    /**
	 * construct object
	 */
	public void draw()
	{
        top = new Circle();
        top.changeColor("red");
        top.moveHorizontal(8);
        top.moveVertical(121);
        top.changeSize(60);
        top.makeVisible();
      
        middle = new Triangle();  
        middle.changeColor("green");
        middle.changeSize(-38, 55);
        middle.moveHorizontal(8);
        middle.moveVertical(247);
        middle.makeVisible();
	 
        bottom = new Triangle();  
        bottom.changeColor("blue");
        bottom.changeSize(7, 11);
        bottom.moveHorizontal(8);
        bottom.moveVertical(246);
        bottom.makeVisible();
   
        top2 = new Circle();
        top2.changeColor("blue");
        top2.moveHorizontal(125);
        top2.moveVertical(175);
        top2.changeSize(60);
        top2.makeVisible();
      
        middle2 = new Triangle();  
        middle2.changeColor("magenta");
        middle2.changeSize(-38, 55);
        middle2.moveHorizontal(125);
        middle2.moveVertical(301);
        middle2.makeVisible();
	 
        bottom2 = new Triangle();  
        bottom2.changeColor("green");
        bottom2.changeSize(7, 11);
        bottom2.moveHorizontal(125);
        bottom2.moveVertical(300);
        bottom2.makeVisible();
        
        
        top3 = new Circle();
        top3.changeColor("yellow");
        top3.moveHorizontal(240);
        top3.moveVertical(141);
        top3.changeSize(60);
        top3.makeVisible();
      
        middle3 = new Triangle();  
        middle3.changeColor("blue");
        middle3.changeSize(-38, 55);
        middle3.moveHorizontal(240);
        middle3.moveVertical(267);
        middle3.makeVisible();
	 
        bottom3 = new Triangle();  
        bottom3.changeColor("black");
        bottom3.changeSize(7, 11);
        bottom3.moveHorizontal(240);
        bottom3.moveVertical(266);
        bottom3.makeVisible();
        
    }    
     /**
      * Create method for balloons to fly
      */
     
     public void slowMoveVertical()
         
    {
        top.slowMoveVertical(-50);
        top2.slowMoveVertical(-50);
        top3.slowMoveVertical(-50);
        middle.slowMoveVertical(-50);
        middle2.slowMoveVertical(-50);
        middle3.slowMoveVertical(-50);
        bottom.slowMoveVertical(-50); 
        bottom2.slowMoveVertical(-50);
        bottom3.slowMoveVertical(-50);
     }
}

You still don't show the Circle or Triangle code, which contain the slowMoveVertical(int) code you are calling.

(And your attitude isn't going to garner an overwhelming desire to help out on this.)

alrite lad, calm it.just ask nicely and i shall.

What? We have no need to "ask nicely". We are not the ones asking for help here. And, it looks as though you aren't going to get any.

What? We have no need to "ask nicely". We are not the ones asking for help here. And, it looks as though you aren't going to get any.

oh shut up u puff, stop whining and just get on with it. if you got nothing helpful to say then fuck off!

commented: I think you just blew all chances for any help here at all. -1

oh shut up u puff, stop whining and just get on with it. if you got nothing helpful to say then fuck off!

Look who's talking.

Not getting much help are you?

I wonder why that is?

Your attitude, maybe?

lol, havnt u got anything better to do u loser.ahh is this ur whole life,bless. i could easily complete this task myself, but thought i'd get someone else to check it out for me first.

i could easily complete this task myself,

Yeah, right. Let me guess you have a few bridges to sell, too, right?

but thought i'd get someone else to check it out for me first.

Rather, you thought you'd try and get someone else to do your (home)work for you. The usual lazy, ungrateful, overbearing, obnoxious, kid. You come a dime a dozen (and over priced at that).

lol, havnt u got anything better to do u loser.ahh is this ur whole life,bless. i could easily complete this task myself, but thought i'd get someone else to check it out for me first.

No, it's not our whole life, but many of us do volunteer a lot of time trying to help those who genuinely wish to learn to program. Some do come along though who only wish for someone else to do their thinking for them and the worst of them have a misguided sense of entitlement. Those individuals really don't even deserve the time it takes to type a response.

Obviously, you cannot easily complete this task or you would have done so by now without help. Good luck finding some assistance with it elsewhere.

yes your right guys, sry about my immature behaviour, i apologize.you guys are trying to help me out at the end of the day. I understand if you dont help me , but i ask whether someone could help me out with this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.