问题标签 [livewires]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
36 浏览

pygame - 用火线计算运动

所以这是我的问题。我有一个图像,我想在屏幕上不断地左右移动。我想每次显示一个计数。我试图在我把它搞砸之前清理我的代码。有人可以帮助我添加我需要添加的内容,以便显示每次图像从屏幕一侧移动到另一侧时的计数吗?我已经添加了代码。 我的代码

0 投票
1 回答
67 浏览

python - 在游戏循环中更新单个精灵

我试图在包括两个精灵的游戏循环中只移动一个精灵。我已经包含spr1Bit.update()方法中,所以如果w被按下spr1.y -= 60。换句话说,精灵被分配到self希望只有在被按下spr1时才会被移动。w但是,在当前代码中,按下w同时移动spr1spr2。怎么才能只spr1在update方法中引用和更新呢?

0 投票
0 回答
162 浏览

python - 无法导入名称“游戏”

我正在使用 Pygame 和 livewire 来练习一些基本的图形操作。

我遇到了一个小错误:

我的代码仅仅是:

我目前在 python 下的 Lib 文件夹中有 pygames 和 livewire。

0 投票
1 回答
26 浏览

python-3.x - 从 livewires.games.Text 对象获取值

我有一个livewires.games.Text名为 score 的对象,我试图从中获取价值。我尝试将其转换为执行scores = str(self.scores)甚至 for 循环:

我得到的只是<livewires.games.Text object at 0x1017aca58>

我正在尝试将分数转换为分数,int()以便我可以在我正在开发的游戏中使用它来提升我的水平。

有没有人曾经使用过 livewires 有没有办法把它<livewires.games.Text object at 0x1017aca58>变成一个int()?

0 投票
1 回答
381 浏览

python - 如何使用带有 Pythons PyGame 的键盘移动精灵?

我正在重制一个视频游戏来学习 pygame 和 livewires。我正在使用 livewires,因为它似乎是用精灵加载背景图形的好方法。

我试图让一个预加载的精灵水平移动,同时在正确的位置保持移动(在这种情况下它向上 50 像素)。

我可以使用 pygame 获得精灵移动,或者我可以将背景与精灵加载在正确的位置,或者我可以让精灵移动,但两者似乎不会同时发生。

为了额外的好处,当角色移动不同的位置时,我还需要屏幕向右滚动。

这是我的代码:

0 投票
1 回答
858 浏览

python - 如何在运行时使用 Visual Studio 调试 Pygame 应用程序

我一直在使用 Pygame 和 Livewires 为家庭作业制作一个小游戏。我一直在尝试调试它,但没有成功;在执行主循环之前,我无法查看要查看的变量。虽然我可以按 F10 跳过主循环,但这只会停止 Autos and Watches 窗口的工作;显然,他们只能在调试器暂停游戏时记录变量。

有没有办法让我使用调试器在运行时查看变量?因为无论我在调试器暂停时做什么,我都无法查看我想查看的游戏对象内部的数据

0 投票
0 回答
25 浏览

python - 是否可以创建一个没有图像的精灵类?

我正在尝试制作一个西蒙说游戏,并且我不需要我的用户精灵有图像,但是是否可以在不调用图像的情况下制作精灵?像下面?还是程序员创建精灵时总是需要调用图像?

0 投票
1 回答
242 浏览

python - python 2.7 livewires - “模块”对象没有属性“init”

我的书中的程序有问题。我写的代码很简单:

和错误:

我通过这个命令安装了数据包(我使用的是 Ubuntu):

我能做些什么来运行这个程序?

0 投票
0 回答
239 浏览

python - 尝试为 Python 3.6 使用 livewires 和 pygame 时出现 ModuleNotFoundError

我正在使用 Python 3.6 并已成功安装 pygame 1.9.3 和 livewires 2.0。我正在尝试运行以下代码:

我得到 ModuleNotFoundError:

代码来自 Michael Dawson 的《Python Programming for the Absolute Beginner, 3rd Edition》一书。我尝试安装不同版本的库,但没有任何效果。

有没有办法来解决这个问题?我会很感激任何建议。

0 投票
2 回答
295 浏览

python - Python livewires resize screen

I am trying to create a game using livewires in which there are multiple levels. In each level, the screen will need to be a different size, so either I can create a new screen, or I can resize it. When I tried a new screen, like this (mcve):

I get the error:


games.screen.width and height cannot be set (you can only get them), so I cannot do it like that, and when I change add line in livewires.games to reset the screen count to 0, I get an error in pygame instead.

Does anyone know of a way to resize, or else destroy and recreate the screen in livewires?


Note: I'm using Michael Dawsons edited version. Download for pygame and livewires used.