pygame

How Do I Scroll My BackGround Image In Pygame? [duplicate]

∥☆過路亽.° 提交于 2020-12-12 02:27:27
问题 This question already has answers here : Making the background move sideways in pygame (2 answers) Closed 2 months ago . I was Wonder How I Could Scroll mY background image in pygame I have a moving object I want it to scroll when that object is moving here is a video of the background image right now video right now I am just blitting the background image def redrawwindow(): window.blit(bg,(0,0)) here is my full code import pygame import random pygame.init() #this is screem height window =

Why does my simple pygame lag? [duplicate]

流过昼夜 提交于 2020-12-11 12:12:33
问题 This question already has an answer here : Lag when win.blit() background pygame (1 answer) Closed 2 months ago . I have been making a simple python game using pygame and after I added the feature of switching guns the game started to lag. I have no idea why it is lagging. I have tried rebooting but it didn't work. The code is really short so maybe it is just my computer, but if there is anything that may help run it faster please let me know. Here is the code: import sys, pygame, pygame

How do I rotate a sprite towards the mouse and move it?

浪尽此生 提交于 2020-12-11 06:28:48
问题 I'm confused by the fact that in my code the sprite's coordinates don't seem to change where it is. Putting (200, 200) would be the same as putting (900, 100000). So basically i cannot coordinate the sprite in a designated position. Can you help? Turning credits to Ann Zen But the sprite problems on me Pygame sprite not turning accordingly to mouse My code: import pygame from math import atan2, degrees # tank = pygame.image.load('Sprite0.png') wn = pygame.display.set_mode((400, 400)) class

How do I rotate a sprite towards the mouse and move it?

那年仲夏 提交于 2020-12-11 06:22:29
问题 I'm confused by the fact that in my code the sprite's coordinates don't seem to change where it is. Putting (200, 200) would be the same as putting (900, 100000). So basically i cannot coordinate the sprite in a designated position. Can you help? Turning credits to Ann Zen But the sprite problems on me Pygame sprite not turning accordingly to mouse My code: import pygame from math import atan2, degrees # tank = pygame.image.load('Sprite0.png') wn = pygame.display.set_mode((400, 400)) class

Python - pygame error when executing exe file

百般思念 提交于 2020-12-09 04:33:06
问题 So, I'm working on a little project for myself, using pygame and tkinter to build an mp3 player. Everything works when running the program using visual studio, but when I turned the program to an .exe file using pyinstaller and tried to run in, the following appeared: pygame.mixer.load(song) pygame.error Failed to execute script I've tried everything, but it keeps telling me the same. Here you can see how I call the song: pygame.init() pygame.mixer.init() song = path + '\music\\' + selected

Python - pygame error when executing exe file

放肆的年华 提交于 2020-12-09 04:30:53
问题 So, I'm working on a little project for myself, using pygame and tkinter to build an mp3 player. Everything works when running the program using visual studio, but when I turned the program to an .exe file using pyinstaller and tried to run in, the following appeared: pygame.mixer.load(song) pygame.error Failed to execute script I've tried everything, but it keeps telling me the same. Here you can see how I call the song: pygame.init() pygame.mixer.init() song = path + '\music\\' + selected

Simple drag physics, acting differently when moving left or right [duplicate]

六眼飞鱼酱① 提交于 2020-12-07 06:41:54
问题 This question already has answers here : Pygame doesn't let me use float for rect.move, but I need it (2 answers) How to draw a moving circle in Pygame with a small angle at a low speed and blinking? (1 answer) Closed 13 days ago . My code is acting differently for negative velocities than it is positive ones I'm trying to implement platformer physics, the player has velocity in the X direction, the velocity is increased or decreased when the user presses "A" or "D" respectively, or set to 0

Simple drag physics, acting differently when moving left or right [duplicate]

守給你的承諾、 提交于 2020-12-07 06:40:27
问题 This question already has answers here : Pygame doesn't let me use float for rect.move, but I need it (2 answers) How to draw a moving circle in Pygame with a small angle at a low speed and blinking? (1 answer) Closed 13 days ago . My code is acting differently for negative velocities than it is positive ones I'm trying to implement platformer physics, the player has velocity in the X direction, the velocity is increased or decreased when the user presses "A" or "D" respectively, or set to 0

Simple drag physics, acting differently when moving left or right [duplicate]

风流意气都作罢 提交于 2020-12-07 06:39:04
问题 This question already has answers here : Pygame doesn't let me use float for rect.move, but I need it (2 answers) How to draw a moving circle in Pygame with a small angle at a low speed and blinking? (1 answer) Closed 13 days ago . My code is acting differently for negative velocities than it is positive ones I'm trying to implement platformer physics, the player has velocity in the X direction, the velocity is increased or decreased when the user presses "A" or "D" respectively, or set to 0

Texture arrays in OpenGL

淺唱寂寞╮ 提交于 2020-12-06 19:44:23
问题 I am working on a project and I need to use texture arrays to apply textures. I have asked many questions about this, none of which I got an answer I was completely satisfied with (Get access to later versions of GLSL , OpenGL: Access Array Texture in GLSL , and OpenGL: How would I implement texture arrays?) so I'm asking a more broad question to hopefully get a response. Anyways, How would I texture an object in OpenGL (PyOpenGL more specifically, but it's fine if you put your answer in C++)