如何让图片在画布上充当游戏角色?

发布于 2024-10-07 09:44:55 字数 186 浏览 0 评论 0原文

我在 JAVA 中有一个迷宫游戏,我正在为一堂课做,迷宫是在小程序中的画布上制作的,我想向我提供另一张图片(类似雕像的东西)作为游戏角色并能够通过方向键在迷宫中移动,那么如何将一个对象放置在画布上,可以移动和控制等?目前,我将雕像放在迷宫上的唯一方法是将图片的像素复制到迷宫上,所以它现在只是背景的一部分......请帮助我!我到处发帖寻求帮助,但无济于事。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遥远的绿洲 2024-10-14 09:44:55

在 ContentPane 上方,您会发现存在一个 GlassPane。这是添加雕像图片而不弄乱背景的正确位置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文