Hello everone
I have to program various chess puzzles for a school project. I would like to ask if it is possible to click on a picture of the chess figure in a figure and move it?
For example: For the move rook from f1 to f8, that you can click on the rook at f1 and then on the square f8 and the rook changes the position on the figure.
%Loading the images of the chess figures
Figures;%Size of the chess figures 100x100
n = 100;%Showing the chessboard. Size 872x872 with borders with a wide od 36 Pixels.
%The actual Chessboard has the size 800x800
Cb = imshow('Cb.png');hold on%Showing the figures on the chess board. kbw means k = king, b = color of the chessfigure, w = color of the field.
a8 = imshow('kbw.png');%Setting the position of the figur.
set(a8,'XData',[37 136],'Ydata',[37 136]);h1 = imshow('kww.png');set(h1,'XData',[37 136]+n*7,'Ydata',[37 136]+n*7);h8 = imshow('qww.png');set(h8,'XData',[37 136]+n*7,'Ydata',[37 136]+n);f1 = imshow('rww.png');set(f1,'XData',[37 136]+n*5,'Ydata',[37 136]+n*7);
Best Answer