How do I have a picture act as a game character on top of a canvas?

人走茶凉 提交于 2019-12-24 09:38:36

问题


I have a maze game in JAVA I'm doing for a class, the maze is made on a canvas in an applet, I wanted to have another picture provided to me (of a statue like thing) act as a game character and be able to be moved around the maze by the arrow keys, so how do I place an object on a canvas that can move around and be controlled, etc.? At the moment, the only way I could get my statue on the maze was by just copying the pixels of the picture onto the maze, so it's just part of the background now...Please help me! I've been posting everywhere looking for help to no avail.


回答1:


Above the ContentPane you will find that exists a GlassPane. It is the right place to add your statue picture without messing with the background.



来源:https://stackoverflow.com/questions/4432998/how-do-i-have-a-picture-act-as-a-game-character-on-top-of-a-canvas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!