Moving checkers/draughts pieces?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Moving checkers/draughts pieces?
Hi, I'm trying to find out how to move the checkers/draughts pieces on a specific square and how to make them set up as in setting out the checkers/draughts board. I don't understand how to use LC fully yet so if you can, please can you tell me how each step work for example on line 1 this code does this. Thank you!
Re: Moving checkers/draughts pieces?
What you want is to work with the location of objects. For example:
So if you want to change an objects location you'd not use "put" but instead you'd use "set":
When you want to move a button you can use the move command to move it between two points:
Because the location works with a cartesian x,y coordination system, you can also create a virtual grid:
now that you have a grid, you can set the location of a button to one of the coordinates, or use two from the list as a start to move the button.
Code: Select all
put the location of button 1
Code: Select all
set the location of button 1 to 100,100
Code: Select all
move button 1 from 45,60 to 80,120
Code: Select all
put 45 into xMargin --we use this later to make sure our grid doesn't start at 0
put 40 into yMargin --same for y
repeat with x = 1 to 12 --x starts with 0 at the left and then goes up towards the right
repeat with y = 1 to 12 --y starts with 0 at the top and goes up towards the bottom
put x,y && x*10,y*10 & return after theResult
end repeat
end repeat
put theResult
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Moving checkers/draughts pieces?
Thank you BvG