so I'm making a videogame
古いコメントを表示
I have a vector of enemy handles so that I can assign visibility to certain enemies and not others, but once I update all of their positions (xdata and ydata), the visibility gets messed up and all become visible in the entire map. Anyone know why? I tried to use get(e,'visible') but it returns a cell of 'on' or 'off' that sucks to feed into set
回答 (3 件)
Stephen
2012 年 5 月 24 日
Matt Kindig
2012 年 5 月 24 日
Do you have any calls to 'drawnow'? I don't think that simply changing the xdata/ydata is supposed to change handle visibility. Some other commands, such as 'figure', 'pause', and others automatically call drawnow.
One way you could quickly set all visibilities is to pass in a vector of handles to the set command. Something like:
set( HandlesOfHiddenObjects, 'Visible', 'off');
set( HandlesOfVisibleObjects, 'Visible', 'on');
2 件のコメント
Walter Roberson
2012 年 5 月 24 日
drawnow() should not affect the visibility of anything.
Stephen
2012 年 5 月 24 日
Walter Roberson
2012 年 5 月 24 日
0 投票
You cannot set the visibility of individual points in a line object. Your visibility with that code is going to be set according to the last value that happens to be in the array.
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!