Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    See post #31
  2. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Can you be changing a Tile that is not in the ArrayList?

    It is very hard to understand what you are doing. There are many ways the code could do what you are describing.
    If you get a reference to...
  3. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    I don't understand what the problem is or what you are trying to do.
    An ArrayList contains references to objects. You can change the contents of any of those objects and not effect the ArrayList. ...
  4. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    I have no idea what you are talking about.
    If you have any questions, you'll have to show the code and ask specific questions about it.
  5. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Time for some more debugging.
    Do you see how the printing out of the values of the tiles before the if statement showed you what the problem was for detecting collisions?
    With the new problem, you...
  6. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    I guess it doesn't.

    There is no relationship between some hardcoded values in a call to the drawRect() method and the values saved in an extension of the Rectangle class. You have to set them....
  7. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Where are they being set?
  8. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Did you look at what was printed? If width and height = 0, I don't think contains() can be true.

    Where are the values of pt1 and pt2?


    What is a Tile class object? What does its toString()...
  9. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    The printlns should be BEFORE the values of the variables are used, not AFTER:


    public boolean isCollidingWithFloor(Point pt1, Point pt2){
    System.out.println("L.T.size="+Level.tile.size());...
  10. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Can you post the code with printlns in the isCollidingWithFloor() method
    and also post the output from those printlns?
  11. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Did you print out the value of Level.tile.size() in the isCollidingWithFloor() method?
    Is the tick() method being called? Add a println first thing in tick() that prints a message to see.
    ...
  12. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    If the println line doesn't print anything that would indicate that the statement is not being executed.

    Check the logic to see if it is possible that the println is not being executed. Add lots...
  13. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Please explain. Something must print or is there an error?

    Can you post the println statement and the next few lines of code that shows where the println statement is located?

    Is this the...
  14. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Which are the values of Level.tile.get(f),
    which are pt1
    and which are pt2


    I would expect to see the values of all three printed just before this line:

    if(Level.tile.get(f).contains(pt1)...
  15. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    What is printed out by the printlns of the variables?
  16. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Check a virtual move before doing the actual move.
  17. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Can you explain what the problem is and post some print outs that shows it?
    You haven't provided any useful information yet about what is happening.
  18. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    I'd use the term shape instead of object. In OOP an object relates to an instance of a class.
    A shape is something drawn on a screen.

    What prints out when you print the contents of the variables...
  19. Replies
    42
    Views
    2,883

    Re: Checking if an object contains a point

    Are you asking about the location of shapes drawn on a Graphics context?
    What kind of shapes are you working with?

    Can you explain what happens when the code is executed?

    Try debugging the...
Results 1 to 19 of 19