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...
Type: Posts; User: Norm
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...
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...
Somewhere that dx is in scope:
dx = 0;
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...
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.
Add a method to Person that you can call to do what you want.
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...
The position and speed of an object should be contained in the object.
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.
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.
Yes, you would need the width and height to define the rectangle that surrounds the person.
Is the person a point without width and height? The person's rectangle would be its x,y & width and height.
The Rectangle class has methods for detecting intersection that might be useful.