I was making a tic tac toe game in JavaScript graphics (I think) and I called a function to get the row of the click (the function that isn't working is the getRow function) and there isn't any output from the function
var WIDTH = 400;
var HEIGHT = 400;
setSize(WIDTH, HEIGHT);
var WINNING_LINE_WIDTH = 10;
var WINNING_LINE_COLOR = Color.red;
//high
var width = getWidth() / 3;
//thick
var height = getHeight() / 3;
//x != o
var shape = 0;
//1 2 3, as easy as A B C
var row = 0;
//ready, set, GO!!!!
function start(){
grid();
mouseClickMethod(click);
}
//lines
function grid(){
var line1 = new Line(width, 0, width, getHeight());
var line2 = new Line(width * 2, 0, width * 2, getHeight());
var line3 = new Line(0, height, getWidth(), height);
var line4 = new Line(0, height * 2, getWidth(), height * 2);
add(line1);
add(line2);
add(line3);
add(line4);
}
//notrick
function click(e){
var clicky = e.getY();
getRow(clicky,row);
println(row);
println(clicky);
println(height);
println(height * 2);
println(height * 3);
}
//row row row ur boat
function getRow(clicky, row){
if(clicky < height){
return row + 1;
} if(clicky >= height && clicky <= height * 2 ){
return row + 2;
} else{
return row + 3;
} return row - 1;
println("nothing");
}