pygame

My pygame character leaves trails when I move it [duplicate]

坚强是说给别人听的谎言 提交于 2020-11-29 09:18:33
问题 This question already has answers here : Pygame how to fix 'trailing pixels'? (4 answers) Closed 3 years ago . I've been trying to make a game in Python but when I move my character it leaves a trail behind. I know it doesn't show that much but if you get close you can see the trail and it really bothers me. Here's my code: import pygame import os from pygame import mixer pygame.init() mixer.init() width = 800 height = 600 black = (0,0,0) white = (255,255,255) ship_width = 56 ship_height = 64

How to fix this DeprecationWarning

丶灬走出姿态 提交于 2020-11-29 09:12:25
问题 DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. win.blit(playerStand, (x, y)) DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. win.blit(walkLeft[animCount // 5], (x, y)) 回答1: The warning is related to the coordinate parameter of blit(). Floating point

Why are my rects not working and making the player interact with the door as it is supposed to in pygame [closed]

只愿长相守 提交于 2020-11-29 03:07:23
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 26 days ago . Improve this question I am trying to make the player sprite act when he touches the door but it is not working. I am trying to make it print the word collision but it is not appearing.Most of the code comes from: https://pythonprogramming.altervista.org/platform-game-in-detail-part-1/?doing_wp_cron

Why are my rects not working and making the player interact with the door as it is supposed to in pygame [closed]

☆樱花仙子☆ 提交于 2020-11-29 03:06:31
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 26 days ago . Improve this question I am trying to make the player sprite act when he touches the door but it is not working. I am trying to make it print the word collision but it is not appearing.Most of the code comes from: https://pythonprogramming.altervista.org/platform-game-in-detail-part-1/?doing_wp_cron

Collision between masks in pygame

你说的曾经没有我的故事 提交于 2020-11-29 02:55:42
问题 I have a problem with collisions in my game, spaceship's mask doesn't collide properly with a background and I believe that offset is a problem, however I'm not sure. I've tried multiple collision techniques and checked a lot of answers to my problem, but none of them helped me. import pygame as pg import os os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (2, 29) pg.init() def gameLoop(): display_width = 1800 display_height = 1000 pg.display.set_caption("Kerbal Space Landing Simulator") clock

Collision between masks in pygame

喜夏-厌秋 提交于 2020-11-29 02:53:36
问题 I have a problem with collisions in my game, spaceship's mask doesn't collide properly with a background and I believe that offset is a problem, however I'm not sure. I've tried multiple collision techniques and checked a lot of answers to my problem, but none of them helped me. import pygame as pg import os os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (2, 29) pg.init() def gameLoop(): display_width = 1800 display_height = 1000 pg.display.set_caption("Kerbal Space Landing Simulator") clock

私藏已久的7个Python视频教程

被刻印的时光 ゝ 提交于 2020-11-26 02:00:50
有读者问到有没有Python视频教程,如果你善用搜索引擎的话,网上资源一抓一大把,甚至还有机会接触到国际顶尖大学的计算机视频课程。看视频的好处能跟着老师的思路一起学习,虽然效率没有直接啃书快,但对于看不进书或者看不懂书的人来说,视频可能是最好的入门教程之一。如果身边还配个老师可以手把手教你就更好了,但自学本身就代表一种能力。 以下是放在收藏夹已久的几个学习视频 1、Python 基础和编码规范 鹅厂内部员工学习Python总结的一些方法,可用于快速了解Python,适合有其它语言编程基础的同学看,一个小时带你玩转Python 地址: https://cloud.tencent.com/developer/edu/course-1109 2、400全集Python全套视频教程 此套视频信息量非常大,我画了个思维导图,除了上面的知识点,还有大量的练习和实践项目。 地址: https://www.bilibili.com/video/av19956343/ 3、20G黑马Python入门教程 想短期快速入门,但是看书又看不下去的话,这个视频教程帮你15天入门,包括学前环境搭建,基于Ubuntu的开发环境,1-3天内容为Linux基础命令,4-13天内容为Python基础教程。14-15 天内容为飞机大战项目演练。 地址: https://pan.baidu.com/s

私藏已久的7个Python视频教程

生来就可爱ヽ(ⅴ<●) 提交于 2020-11-26 01:10:44
有读者问到有没有Python视频教程,如果你善用搜索引擎的话,网上资源一抓一大把,甚至还有机会接触到国际顶尖大学的计算机视频课程。看视频的好处能跟着老师的思路一起学习,虽然效率没有直接啃书快,但对于看不进书或者看不懂书的人来说,视频可能是最好的入门教程之一。如果身边还配个老师可以手把手教你就更好了,但自学本身就代表一种能力。 以下是放在收藏夹已久的几个学习视频 1、Python 基础和编码规范 鹅厂内部员工学习Python总结的一些方法,可用于快速了解Python,适合有其它语言编程基础的同学看,一个小时带你玩转Python 地址: https://cloud.tencent.com/developer/edu/course-1109 2、400全集Python全套视频教程 此套视频信息量非常大,我画了个思维导图,除了上面的知识点,还有大量的练习和实践项目。 地址: https://www.bilibili.com/video/av19956343/ 3、20G黑马Python入门教程 想短期快速入门,但是看书又看不下去的话,这个视频教程帮你15天入门,包括学前环境搭建,基于Ubuntu的开发环境,1-3天内容为Linux基础命令,4-13天内容为Python基础教程。14-15 天内容为飞机大战项目演练。 地址: https://pan.baidu.com/s

When I try to install pygame using python 3.9 I get an error windows

你。 提交于 2020-11-25 03:56:43
问题 There s currently no version of pygame for python 3.9 回答1: As of https://github.com/pygame/pygame/pull/2163 there are prebuilt binaries for Python 3.9 starting with pygame version 2.0.0.dev14 . pip install pygame==2.0.0.dev14 回答2: My question is exactly the same as yours. I have tried many methods, but none of them will work. But I succeeded after using this. pip install pygame==2.0.0.dev14 来源: https://stackoverflow.com/questions/64261106/when-i-try-to-install-pygame-using-python-3-9-i-get-an

Changing colour of a surface without overwriting transparency [duplicate]

百般思念 提交于 2020-11-25 03:45:18
问题 This question already has answers here : Is it possible to change sprite colours in Pygame? (1 answer) Trying to make sections of sprite change colour, but whole sprite changes instead (1 answer) Closed 17 days ago . I want to change the colour of a rect dynamically during runtime. Currently set_colour is filling all of the pixels of the surface with a single colour value. This works, but an issue arises when a method like set_outline is called, which modifies the transparency of the surface.