Hello, I'm trying to make a text class, which will take in a integer variable, and display it on the screen.
My problem, is that when I add a new object to the ArrayList, the integer is used in the class, but it's never updated: eg.
text.add(new TextBlock(new PVector(180, 120), projectile.numberOfBullets, constantia20));
So, if I'm trying to get the TextBlock to display the number of bullets that the player has, the TextBlock will take in the current bullets, but it won't update if the "numberOfBullets" variable is changed. I'm guessing that this is because the class takes in the value of the "numberOfBullets" variable, but it doesn't actually take in the variable itself.
What can I do to get around this problem? Any help will be appreciated.
EDIT: Just to clarify, I'd like to have "
text(intNum, pos.x, pos.y);" behave as though it was written like "
text(projectile.numberOfBullets, pos.x, pos.y);".
class TextBlock extends Menu {
int intNum;
TextBlock(PVector position, int integer, PFont fSize) {
The program I'm trying to make is very simple. The first dot on the screen is in the center, and the second dot rotates around the first one, and the third dot rotates around the second one. However, the issue that I'm having is that the third dot rotates around the first one. I just can't seem to think of a way to get the dots to translate around the previous dot.
EDIT:
I fixed the problem. For lines 21-25, I changed the code to:
The pushMatrix/popMatrix was causing the problem, as well as having spacing inside of ellipse().
I'm having a new problem though. Each dot is dependent on the previous dot. So, if the first dot has an angle of 45, the second dot will have an angle of 90. I'd like the position of the dot to be dependent, but I want the rotation to be completely independent from the previous dot.
The code I have so far creates dots on the screen. I'm still trying to wrap my head around ArrayLists and classes, so maybe I'm getting ahead of myself here... but what I'd like to be able to do is get the x and y value's of each dot on the screen.
I looked at PVector (
http://processing.org/reference/PVector.html), but I still don't understand how to use it, or how it works. I'd greatly appreciate it if someone could give me a push in the right direction and give me a better explanation of PVector.