//draw the points
//var pointOrigins1=new Array();
//pointOrigins1 = drawPoints(canvas, context);
//var pointOrigins2=new Array();
//pointOrigins2 = pointOrigins1;
//pointOrigins2.reverse();
//Place a donut on each point origin
//circlePointOrigins(canvas,context,pointOrigins1);
console.log(drawPoints(canvas, context));
//console.log(pointOrigins1);
//console.log(pointOrigins2);
//renderCheckers(canvas,context,pointOrigins1,pointOrigins2,checkers1,checkers2,initiator);
function drawPoints(canvas,context) {
pointOrigins.push(drawTriangle(50+i,550,false,'black',canvas,context));
return pointOrigins;
}
The code below is run. In the above code I have commented out what I have been trying that is not working yet. My goal is to reverse the returned array that is returned from the drawPoints function:
console.log(drawPoints(canvas, context));
Runs and the output looks like in the console:
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
I'm noticing that in the render event of gameview
if I call:
var pointOrigins1=new Array();
pointOrigins1 = drawPoints(canvas, context);
var pointOrigins2=new Array();
pointOrigins2 = pointOrigins1;
pointOrigins2.reverse();
the reverse has no effect at all. I intend to use the .reverse function for use with JavaScript arrays but right now that is not working.
I'm not sure how to resolve the .reverse problem yet but I think it might have something to do with how I am returning my functions.
Thank you for posting....