A have a Swift project that moves sprites around the screen. The GameVC has scene size (width, height) values in it.
I have code inside a MoveComponent class in the agentWillUpdate function to keep sprites on the screen by testing max and min limits
and reversing sprite direction if the limits are hit.
The above works perfectly IF I use hard numbers for the scene limits in the agentWillUpdate function.
I have been unable to figure out how to pass the scene height and width parameters from the GameVC to the MoveComponent class file so that I don't have to use hard numbers (actually since (0,0) are the lower limits, those are OK. I only need the upper limits).
What am I missing? It seems like this should be easy. Could someone provide a simple example of how this should be done? I've looked on the web for examples, but some involve sequeing to another VC which is not what I'm doing. So far all I've tried has failed.
Any advice would be appreciated. Thanks in advance.