You almost had it, but you need to learn about what a “scope” is in C++ (Scope - cppreference.com).
With this, as well as the other answer, you’ll start to understand more about how scopes and parameters work.
Now, to solve your issue, the ShouldReturnFunction
is aware of the following variables:
- StartPosition (declared in the class)
- LimitDistance (also declared in the class)
- CL (the parameter)
- (PlatformVelocity too, but you don’t use it)
It is not aware of:
- CurrentLocation (only defined in MovePlatform)
You need to replace CurrentLocation (at line 64) with CL.
When you call the function at line 39, CL has the value of CurrentLocation