I am having a circular reference problem.
I'm trying to play with this tutorial https://coronalabs.com/blog/2015/04/07/tutorial-working-with-a-grid-layout/ which of course the source file has been moved or deleted, so have cut and pasted the code and am trying to make it into a game.
I've managed to make it place red pieces along the top and white pieces along the bottom instead of randomly spawning a number of pieces.
Now I want to make it move a piece when I click on the piece.
Trouble is I can't work out how to designate a clicked on piece as something that should be moved. Maybe it's a problem with my event listener code (which I can't get anything to work AT ALL). It's like I could move it if I knew what its "name" was, but I need the name to be able to run a function to get the name!
Code is below.
The section I'm having trouble with is about lines 99 (where I'm trying to get the name of a touched object), line 106 (where I'm trying to touch an object) and the function from line 49 (where I'm trying to move it).
I also need some way of adding or subtracting 1 square to the 'y' so it moves down.
Edited to do what the two commenters have asked : cleaned up code and used <> and added line numbers (using excel and Word because I didn't know how else to do it).
Edited again because my attempts to use <> and line numbers made the post exceedingly longer. Instead, here's a screenshot. I suppose I'm going to put that in wrong as well.
Apparently I'm not allowed to put in a PNG or JPG image. This is getting stupid. What image types does the forum allow? I guess you don't get to see the code.
Edited by Rodayan, 28 December 2018 - 12:32 PM.