Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Time for some debugging. Print the values of the variables that control where and when the person moves. Be sure to indicate the place and time when the person should stop moving. If the person's...
  2. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    If dx is in another class, then you need a reference to that class and a method in that class to call that will do what you want.

    aRefToClassWith_dx.methodToClear_dx(); // call a method to clear...
  3. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Somewhere that dx is in scope:

    dx = 0;
  4. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    What you posted looks like a constructor not a method. A method has a return type in its definition.


    Please post the full text of the error message. Your description makes no sense.
    The...
  5. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Please post the full text of any errors you want help with.

    You could put the method(s) next to any of the other methods.
  6. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Add a method to Person that you can call to do what you want.
  7. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    The Person class has the dx and dy variables. If the Board class has a reference to a Person object, it can call methods in the Person class to access those variables.

    You have not explained why...
  8. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    The position and speed of an object should be contained in the object.
  9. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    To change variables in a class, add a method to the class that you can call to change them.

    Not sure what you mean by "If they both collide". It takes two objects to have a collision.
  10. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    It all depends on what you want to happen when there is a collision. Define that and then you can work on the code to implement it.
  11. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Yes, you would need the width and height to define the rectangle that surrounds the person.
  12. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    Is the person a point without width and height? The person's rectangle would be its x,y & width and height.
  13. Replies
    29
    Views
    6,350

    Re: Collision Detection between Sprites and Images?

    The Rectangle class has methods for detecting intersection that might be useful.
Results 1 to 13 of 13