How can I make a feature in a GUI that my user can drag around?

조회 수: 7 (최근 30일)
Alyssa
Alyssa 2022년 11월 14일
편집: Jan 2022년 11월 14일
I am making a Chutes and Ladders Game using a GUI. I want my user to be able to move their own icon on the board, like you would if you were actually playing the game. Is there any way to make some sort of shape, rectangle, circle, etc., that my user would be able to move from square to square on my board? The board is an inputted image onto an axes just to clarify, and I want the shape to be in the GUI itself. I am a beginner so anything will help. Thanks!
  댓글 수: 1
Jonas
Jonas 2022년 11월 14일
you could use drawrectangle or drawcircle to generate a rectable or circle which can be drawn by the user. You could the set up listeners to the MovingRoi or RoiMoved to set constraints to the positioning possibilities or moving e.g. the image representing the playing token. Do not forget to remove the deleting possibility from the context menu (or removing the context menu (right click) at all)

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2022년 11월 14일
편집: Jan 2022년 11월 14일
You find some examples for defining and moving sprites in the FileExchange:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Strategy & Logic에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by