腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
Pygame
colliderect
()
函数
返回
0
(
零
)
和
1
(
1
)
而
不是
True
和
False
?
python
、
python-3.x
、
pygame
、
pygame2
colliderect
()
函数
不会
返回
True
和
False
;相反,它
返回
0
和
1
。当我使用
函数
类型时,它显示int
而
不是
bool。如果我使用
0
和
1
而
不是
布尔值编写代码,那么代码可以工作,但是为什么会发生这种情况呢?
Pygame
文档没有提到任何关于它的内容。de
浏览 109
提问于2021-03-22
得票数 4
回答已采纳
5
回答
MySQL:
返回
"
0
“
和
"
1
”,
而
不是
"
false
“
和
"
true
”
sql
我需要
返回
true
或
false
,
而
不是
1
&
0
,使用以下查询:from user u以上查询
返回
值为
0
或
1
的status,
而
不是
true
和
false
, 有办法解决这个问题吗?
浏览 13
提问于2016-02-29
得票数 5
回答已采纳
2
回答
在Python中没有运行第二个条件的"if cond
1
或cond2“语句
python
、
if-statement
、
pygame
=
False
speed = 4hgjumpallowed =
False
def stop() : returnhitmangrandma =
pygame
.image.load('hgrd
1</e
浏览 0
提问于2017-05-02
得票数 1
回答已采纳
2
回答
在带有冲突的电子游戏中创建得分
函数
python
、
function
、
pygame
、
sprite
当两个精灵在我的比赛中碰撞时(球员
和
钥匙),我希望得分变量增加100分。我尝试过很多方法,但它们都做了同样的事情;当精灵与键接触时,变量不断增加。我需要它每次碰撞增加一次。(SURF, (
0
,
0
,
0
), (k_spritex, k_spritey, 30, 40),
1
) p_score_rect =
pygame
.draw.rect(SURF, (
0
,
0
,
0
),(p_spritex, p_spritey, 30, 40),
浏览 0
提问于2016-04-12
得票数 2
回答已采纳
1
回答
碰撞随机检测
和
终止程序
python
、
pygame
、
collision
这是我第一次尝试
和
项目的
pygame
,所以我
不是
最好的。return
False
display = Score_font.render(f"Score: {score}",
True
, (181, 26, 18, 0.86)) display
1
= Score_font.render(f"OldScore: {oldscore[
0
]}",
True
, (18
浏览 20
提问于2021-10-19
得票数 0
1
回答
如果两个矩形都在移动,如何检测一个矩形是否在另一个矩形中?
python
、
pygame
')x2 =
0
clock =
pygame
.time.Clock()vel_x, vel_y =
0
,
0
sa =
0
浏览 19
提问于2019-02-28
得票数 1
回答已采纳
3
回答
AttributeError:“
pygame
.Rect”对象在执行冲突时没有属性'rect‘错误
python
、
pygame
rect): self.y = y self.height = heightclass Ball: coordinateY = 300 player =
浏览 1
提问于2020-04-01
得票数 2
回答已采纳
1
回答
派克碰撞检测“碰撞()”
python
、
pygame
在浏览的过程中,有一种叫做
colliderect
()的游戏方法,用于测试两个rect对象是否重叠。对撞机()测试两个矩形是否重叠如果任意矩形的任何部分重叠( top+bottom或left+right边缘除外),则
返回
true
。
浏览 1
提问于2020-05-04
得票数 1
回答已采纳
1
回答
在我的逃逸室游戏中,我很难展示其中的一把钥匙
python
、
pygame
))velocity =
1
clock =
pygame
.time.Clock()blue= (
0
,
0
,255)brown = (110,38,14)y = 300while
True
:
浏览 4
提问于2022-07-22
得票数 0
1
回答
对象间的Python博弈碰撞检测
python
、
pygame
coordinate, -Y is above screen (top of screen is zero)
pygame
.quit()
浏览 0
提问于2020-12-12
得票数 1
回答已采纳
2
回答
Python/
PyGame
如何检查一个rect是否在所有四个方向上都位于另一个rect的正上方或旁边?
python
、
pygame
我正在用Python
和
PyGame
做一个游戏,我想实现一个视线系统,当你在他们的长度或宽度内时,敌人可以发现你(他们是Rect)。检查这一点最有效的方法是什么?
浏览 0
提问于2017-09-27
得票数 0
1
回答
如何防止精灵重叠在一起
python
、
python-3.x
、
pygame
所以我对
Pygame
并
不是
很有经验,我想知道如何防止敌人重叠。我已经尝试了几种方法,但几乎没有成功。我想听听你对我如何做这样一件事的想法。我认为一个好主意是通过碰撞检测。=
0
notsprinthunger =
True
sprinthunger =
False
vignettex =
0
vignettey =
浏览 0
提问于2019-09-23
得票数 0
2
回答
角色扮演游戏的场景设置
python
、
graphics
、
pygame
、
collision
、
role-playing-game
我在主字符的左、右、上
和
底部创建了4个矩形,每个对象只有一个矩形,即对象的大小。在此之后,我告诉程序,如果有碰撞在左边,不要走左边
和
相同的其他三个方面的主要角色。
pygame
.image.load('toptree.png') for event in <em
浏览 0
提问于2016-02-03
得票数 15
2
回答
我一直在尝试用
PyGame
做一个游戏,但是碰撞检测器不工作
python
、
pygame
我一直在尝试学习
PyGame
的基础知识,所以我一直在尝试制作一个非常基础的游戏。这个游戏(应该)由一个红色的方块组成,如果它击中了从天而降的蓝色方块中的一个,它会四处移动并输掉。代码如下: import
pygame
as pgimport random as rd winHeight = 600 return
True
浏览 18
提问于2019-07-01
得票数 1
回答已采纳
1
回答
为什么此碰撞检测不适用于以前创建的对象?
python
、
pygame
、
collision
): running =
False
for ball in ball_list: random_color = (random.randint(
1
,255),random.randint(
1
,255),rando
浏览 17
提问于2018-12-15
得票数 0
回答已采纳
3
回答
我如何用黄鼠狼来探测两个精灵的碰撞?
python
、
pygame
、
sprite
、
collision
我刚开始玩游戏,也
不是
100%流利的蟒蛇,但我很正派。如果有pdf:s当涉及到python时对中级程序员很好的话,那就太好了!speed = [2, 2]screen =
pygame
.display.set_mode(size)blipy = randint(
1
,600) background =
pygame</e
浏览 5
提问于2015-02-12
得票数 2
回答已采纳
1
回答
如何在
Pygame
for Platformers游戏中使用Rect进行碰撞
python
、
pygame
playerimg =
pygame
.image.load("imgs\\player.png")py =
0
win.blit(playerimg(100,50,100,50) pright =
False
while running: running =
F
浏览 1
提问于2020-07-16
得票数 0
1
回答
游戏:在类中使用对撞机
python
、
python-2.7
、
pygame
这是雪碧类: self.color = tuple([random.randrange(
0
, 256), random.randrange(
0
, 256), random.randrange(
0
, 256)]) self.y =
浏览 1
提问于2015-03-07
得票数 0
回答已采纳
1
回答
pacman循环问题,图像无法显示/移动
loops
、
pygame
[
1
] = -
1
* pacman_velocity[
1
] if pacman_boundary.
colliderect
(blue_boundaryblue_velocity[
0
] = -
1
* blue_velocity[
0
] if blue_right ==
True
:mode ==
浏览 2
提问于2013-04-16
得票数 0
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
对象存储
实时音视频
云点播
活动推荐
运营活动
广告
关闭
领券