# Android QuestionLogic (or math) problem..

#### Beja

##### Expert
Longtime User
To all,

To make the long story short.
I have a timer, and I have to move an image and link the image speed by the ever increasing interval value of the timer.. but I must increase the timer interval value and not decrease it because I need the bigger value in another place that needs a positive change.

Anyone has a clue?

#### LucaMs

##### Expert
Longtime User
Non c'ho capito 'na mazza (how can I translate it? hehehe.)

I did not understand very well, but if you have the need to have two inverse values between them I think you should use a subtraction.

Incr = 75

B = B + Incr

C = MaxVal - Incr

or something like this.

#### Beja

##### Expert
Longtime User
Thank you Luca,
it's a little tricky and I am getting old and can't collect my thoughts quickly..
A progress bar value is from 1 to 120
An image speed needs to be changed from timer interval 240(fastest) down to 10 (slowest) Step -10
The problem: how can I map this to that?
Are you young enough to solve this or I should call Klaus

Last edited:

#### Beja

##### Expert
Longtime User
Remember I am using one timer.

#### LucaMs

##### Expert
Longtime User
Thank you Luca,
it's a little tricky and I am getting old and can't collect my thoughts quickly..
A progress bar value is from 1 to 120
An image speed needs to be changed from timer interval 240(fastest) down to 10 (slowest) Step -10
The problem: how can I map this to that?
Are you young enough to solve this or I should call Klaus

Is it a progress bar (1) or a view to set the speed (2)?

1) PB.Progress = Timer1.Interval / 2 (PB values will be 120, 115, 110...5)

2) Timer1.Interval = YourView.Value * 20

or...

I'm too old to understand

#### Beja

##### Expert
Longtime User
sorry I am joking..

It's like this.. now the images start very fast because the counter starts with "1". for PB this is a small value, but for image it is 1 millisecond so it goes very fast. besides upper and lower bounds are different. pls see the picture:

sorry mistake:
img 240 to 10 (step -10)

#### Attachments

• pb-img.jpg
12.1 KB · Views: 168

#### Beja

##### Expert
Longtime User
Briefly!
Map (240 ~ 10 STEP -10) to (1 ~ 120)

#### walterf25

##### Expert
Longtime User
Thank you Luca,
it's a little tricky and I am getting old and can't collect my thoughts quickly..
A progress bar value is from 1 to 120
An image speed needs to be changed from timer interval 240(fastest) down to 10 (slowest) Step -10
The problem: how can I map this to that?
Are you young enough to solve this or I should call Klaus
I'm not sure i understand exactly what you are trying to do.
From what you wrote, if the highest speed is 240 and the decrement step is -10 then, if you divide 240/10 you have 24 steps.
In the timer, if the value of the progressbar is 1 then 1 = 240, 2 = 230.
in other words you could do something like this

B4X:
``````Timer1_Tick
dim val as int
dim speed as int
val = progressbar.value
speed = 240 - (val*10)
End Sub``````

I don't know maybe i'm hearing voices.

Walter

Replies
11
Views
664
Share My Creation KUBZ. A logic puzzle game
Replies
0
Views
1K
Android Question Logic Question
Replies
6
Views
631
Replies
7
Views
2K