I have these 4 spawnpoints (top, bottom, left and right) and when an object is spawned at the left side of the screen I want it to move to the right (and from top to bottom and so on). how do I do this? I manage to spawn the object but it just moves in a random direction…
Maybe include the direction in the script? Then you can set it for each one.
Use an enum, perhaps, if you think that will look nicer. This could be good if you only need 4 directions; you’d just pick from a dropdown “left, right, up, down”, then use a switch statement to determine the direction.
An alternative could be to load the travel directions into a dictionary keyed on the enum. Then the direction could be read directly with something like :
dictTravel [ eStartPos ]