So im trying to build a simple tetris game in Matlab. I am drawing and updating the figure using the patch method with predefined position vectors for each shape.
So far so good, but when i need to delete a row (when the player fills a row), i am stuck as i don't know how to delete a block from the figure. I tried ROI but i can't delete the underlying patches.
Code that draws figures and patches: ...
figureH = figure('name','TETRIS Game','outerposition',[100 100 500 500],'color','g');
%draw game area
patch(xBoard+[0,gameWidth,gameWidth,0],yBoard +[0,0,gameHeight,gameHeight],'w');
...
%drawing shape in each step
activeShapePatch = patch((xBoard-1)+min(fcol)+x,yBoard+gameHeight-max(frow)+y,nextShape{1}{4});
nextShape is just a cell array containing x-y vectors for each shape and color- this is for the patch arguments.