I'm looking at creating instances of an object through random x and y values, which I have already done... however, this is for a snake styled game, and i have a border around the edge meaning that sometimes an instance of my object will occur within this border. And as I have set a hitTest on this border to end the game if you hit it, creates an impossible situation...
So Does anyone know how to create peramiters for random x and y values, so that my instances will occur within the game play ar
It will depend on the shapes of your instances, but you will need to restrict their random location to be well within the borders if touching the border is not desired. So change the limits for the random values you generate to be far enough away from the borders.
What code would I need to enforce these parameters within te game area? I'm not sure what code I would use to go about it... I tried (50*Math.random)+450) is that along the right lines for values between 50 and 450 for a variable value of the x axis?