I'm new to Java programming, I am programming Java 1.6 with Android.
I have a simple function that makes a number go up and down between 0 and 200. I would like to put this into a Sine function but keep getting errors with what I've been trying.
I want my program to update an int (Number1) via a sine wave y axis.
Any ideas change the following logic into a Sine function? (disregard the 2nd number)
code:
private int Number1 = 150;
private int Number2 = 0;
private int counter = 0;
public void updateNumbers() {
if (counter == 0) {
if (Number1 < 200) {
Number1 = Number1 + 50;
Number2 = Number2 - 50;
if (Number1 >= 200) {
counter = 1;
}
}
} else if (counter == 1) {
if (Number2 < 200) {
Number1 = Number1 - 50;
Number2 = Number2 + 50;
if (Number2 >= 200) {
counter = 0;
}
}
}
}