Jump to content

Java: Get() and Set() return default values

After some days trying out and debugging our program we found the fault, but sadly not the answer :(

 

Here is what we have got:

 

We fired up the programm and noted down the X, Y and Accelaration/DeltaX and DeltaY.

After the ball hits the paddle, the deltaX value gets inverted for one instance but gets reseted on the next (and stays there until next collision).

 

Here is the Console output:

run:Entering drawFrame(); X: 1030,000000    Y: 722,000000DX: 20   DY: 20 X: 1050,000000    Y: 742,000000DX: 20   DY: 20 X: 1070,000000    Y: 762,000000DX: 20   DY: 20 X: 1090,000000    Y: 782,000000DX: 20   DY: 20 X: 1110,000000    Y: 802,000000DX: 20   DY: 20 X: 1130,000000    Y: 822,000000DX: 20   DY: 20 X: 1150,000000    Y: 842,000000DX: 20   DY: 20Collision up X: 1170,000000    Y: 862,000000DX: 20   DY: -20 X: 1190,000000    Y: 842,000000DX: 20   DY: 20

Thank you for all your previous help :)

 

The whole code: http://pastebin.com/DQLGNNcj

Of course, it is completly normal to have a GPU at 90°c all the time <_< 

 

Java, Sysadmin, Network Engineer, Project Management

 

 

Love you all - thanks for helping me! ^_^

 

Link to comment
Share on other sites

Link to post
Share on other sites

prepare your coffee

 

the only thing i can suggest is, seeing that you're not used to code the OOP way, to prepare a list of all the classes you will need and the methods that you will need them to have, before actually diving into code

 

Sadly we have to use the exact classes the professor gave us :(

Of course, it is completly normal to have a GPU at 90°c all the time <_< 

 

Java, Sysadmin, Network Engineer, Project Management

 

 

Love you all - thanks for helping me! ^_^

 

Link to comment
Share on other sites

Link to post
Share on other sites

did you apply any of the tips that we gave you?

the code looks quite... similar... to how it was before this discussion

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

did you apply any of the tips that we gave you?

the code looks quite... similar... to how it was before this discussion

 

I am sorry for the abondanation (right?), I'll answer tomorrow :)

Of course, it is completly normal to have a GPU at 90°c all the time <_< 

 

Java, Sysadmin, Network Engineer, Project Management

 

 

Love you all - thanks for helping me! ^_^

 

Link to comment
Share on other sites

Link to post
Share on other sites

I am sorry for the abondanation (right?), I'll answer tomorrow :)

haha yeah, i see you take some good breaks, every time i'm like "oh, that discussion is back again"

Link to comment
Share on other sites

Link to post
Share on other sites

haha yeah, i see you take some good breaks, every time i'm like "oh, that discussion is back again"

 

Again, we had no time to program :(

 

So many exams...

I hope we can get back to normal as soon as possible..

 

However, we made some progress in school last week, here is the newest version: http://pastebin.com/7UwERL9n (hope it's the right version)

 

@Newest Version: The content was edited with supervision of our teacher... :wacko:

Of course, it is completly normal to have a GPU at 90°c all the time <_< 

 

Java, Sysadmin, Network Engineer, Project Management

 

 

Love you all - thanks for helping me! ^_^

 

Link to comment
Share on other sites

Link to post
Share on other sites

public class Brick{    private int brick_positionX, brick_positionY, brick_lenght, brick_height;    private boolean isVisible;       public boolean addBrick(int brick_positionX, int brick_positionY, int brick_lenght, int brick_height, boolean isVisible)    {        System.out.println("Brick.addBrick();");        this.brick_positionX = brick_positionX;        this.brick_positionY = brick_positionY;        this.brick_lenght = brick_lenght;        this.brick_height = brick_height;        this.isVisible = isVisible;        return true;    }...}  --------------      public void Level()    {        System.out.println("Entering the Level();");               //Creating the LinkedList level_bricklist        LinkedList level_bricklist = new LinkedList();               //Creating Object brick        Brick brick = new Brick();               switch(level_counter)        {            case 0:{                        // you just keep adding the same item to the linkedlist, changing its attributes every time, so you end up with a list of identical bricks in the same position (they're actually the same brick named 3 times)                        System.out.println("Adding Bricks to Level 0...");                        level_bricklist.add(brick.addBrick(400, 30, 50, 50, true));                        level_bricklist.add(brick.addBrick(500, 30, 50, 50, true));                        level_bricklist.add(brick.addBrick(600, 30, 50, 50, true));                        break;                   }                   }    }
public class Brick{    private int brick_positionX, brick_positionY, brick_lenght, brick_height;    private boolean isVisible;       public Brick(int brick_positionX, int brick_positionY, int brick_lenght, int brick_height, boolean isVisible)    {        this.brick_positionX = brick_positionX;        this.brick_positionY = brick_positionY;        this.brick_lenght = brick_lenght;        this.brick_height = brick_height;        this.isVisible = isVisible;    }...}  --------------      public void Level()    {        //Creating the LinkedList level_bricklist        LinkedList level_bricklist = new LinkedList();               switch(level_counter)        {            case 0:{                        // every item added in the linkedlist is a new item                        System.out.println("Adding Bricks to Level 0...");                        level_bricklist.add(new Brick(400, 30, 50, 50, true));                        level_bricklist.add(new Brick(500, 30, 50, 50, true));                        level_bricklist.add(new Brick(600, 30, 50, 50, true));                        break;                   }                   }    }
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×