attreyabhatt / space-invaders-pygame Goto Github PK
View Code? Open in Web Editor NEWCreating the game Space Invaders using Pygame Module in Python
Creating the game Space Invaders using Pygame Module in Python
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/home/sarebjanjua/Documents/Code/PyGame/main.py", line 137, in
collision = isCollision(enemyX[i], enemyY[i], bulletX, bulletY)
IndexError: list index out of range
Line 121 and 177: 'if bullet_state is "ready":' Replace "is" with "=="
The enemy does not move(One enemy) where there is only one of them. How should I solve this??
here are the files
i wrote this code about a month ago and it ran file but now when i tried to run it ,an error shows up in the screen.blit() function. I am not sure is there any change in the screen.blit() function in the latest version because i changed my operating system and also upgraded python
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Fatal Python error: PyEval_SaveThread: NULL tstate
Current thread 0x00007f6b0cd9a740 (most recent call first):
File "main.py", line 109 in
Aborted (core dumped)
Hi,
thanks for your great tutorial!
I ran into problems with the sounds: it is not possible to play the laser sound at the same time as the background sound. If done, then the program crashes:
Fatal Python error: PyEval_SaveThread: NULL tstate
I googled the error message and it has something to do with the sound channels. However, trying the different solutions (see https://stackoverflow.com/questions/15385727/pygame-mixer-only-plays-one-sound-at-a-time) did not work for me. Do you have any suggestions?
Python version used: Python 3.6.9
Hello,
I got a type error in Line 105. Can someone please help?
Line 105, in
ufoX[i] += ufoX_change[i]
TypeError: 'int' object is not subscriptable
Attached is the code. Thank you!
Write this project with object-oriented programming.
I completed this project in 4 hours and I wanted to add new feature which add one more new enemy each time I hit one of the enemies,but I can`t do this,if someone could help me I would be grateful!!!Thanks!
I have tried to add "num_of_enemies += num_of_enemies" after the collision occurs so that it adds one more new enemy,but I keep getting this error:
enemyX[i] += enemyX_change[i]
IndexError: list index out of range
If someone knows the right way of doing it,please help!!Thanks in advance;)
The bullet will only count if it hits the enemy directly and not if it goes through its arm.
Please add a permissible license so we can copy it ๐
C:\Users\LENOVO\anaconda3\python.exe C:/Users/LENOVO/Downloads/Space-Invaders-Pygame-master/Space-Invaders-Pygame-master/main.py
C:/Users/LENOVO/Downloads/Space-Invaders-Pygame-master/Space-Invaders-Pygame-master/main.py:121: SyntaxWarning: "is" with a literal. Did you mean "=="?
if bullet_state is "ready":
C:/Users/LENOVO/Downloads/Space-Invaders-Pygame-master/Space-Invaders-Pygame-master/main.py:177: SyntaxWarning: "is" with a literal. Did you mean "=="?
if bullet_state is "fire":
Traceback (most recent call last):
File "C:/Users/LENOVO/Downloads/Space-Invaders-Pygame-master/Space-Invaders-Pygame-master/main.py", line 4, in
import pygame
ModuleNotFoundError: No module named 'pygame'
Process finished with exit code 1
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
'run' isn't configured in the .replit file
try adding 'run = "echo hello word"' to .replit
the bullets aren't appearing Idk what I'm doing wrong
as the whole game is working but the issue is that i am unable to open background music ...as it is showing .wav file is not supported and also showing the backgroung.wav file size is larger than project file
plzzzz help guys .........
When i run the game , everything moves slow, but after 1 or 2 bullets shooted, the speed increase, can you help?
wav files are not downloading that's why I am not able to set sound to my project plzz suggest me some alternatives so that I can do my work done.
I am trying to convert the "main.py" file into an executable file but After creating the executable file it closing immediately. I am unable to play the game with the executable file. Can you fix this out ?
It just gives me a blank black screen when launched
Plays music and can hear background explosions
Any Ideas?
i cant show my player i have put the img too but it doesn't show it
how can i fix the enemy to be seen on the screen without dissappering
there is bug in my enemy movement it is just going off the screen i have made my own version of ot using oop
I have everything the same in code and bullets are still not appearing
C:\Users\oksaj\PycharmProjects\SpaceInvaders\main.py:179: SyntaxWarning: "is" with a literal. Did you mean "=="?
if bullet_state is "fire":
When I start game and press space from one to three times, I get this error:
Traceback (most recent call last):
File "/home/ivandjordjevic/Desktop/Space-Invaders-Pygame/main.py", line 14, in
background = pygame.image.load('screen.blit(background, (0, 0))')
pygame.error: Couldn't open screen.blit(background, (0, 0))
My problem that i want to add a game over sound, i can stop the background sound when is game over , i can add this game over sound but it keeps playing again and again when its supposed to play just once, please help
You should add more speed to your game . You can see my repository on pygame. Or you can add the option of changing the speed from terminal at the start of the game. Also you should change the background doesn't give out the best of pygame.
.
AttributeError: partially initialized module 'pygame' has no attribute 'init' (most likely due to a circular import)
How can I reduce the so said "Bullet Recharge delay" of the player?
import-im6.q16: attempt to perform an operation not allowed by the security policy PS' @ error/constitute.c/IsCoderAuthorized/408. import-im6.q16: attempt to perform an operation not allowed by the security policy
PS' @ error/constitute.c/IsCoderAuthorized/408.
import-im6.q16: attempt to perform an operation not allowed by the security policy PS' @ error/constitute.c/IsCoderAuthorized/408. from: can't read /var/mail/pygame ./main.py: line 11: syntax error near unexpected token
screen'
./main.py: line 11: `screen = pygame.display.set_mode((800, 600))'
For some reason when I run my code only one enemie gets the image rather then all of them. Can anyone help me fix this problem?
This is my code:
enemie_ship = []
enemieX = []
enemieY = []
enemieX_move = []
enemieY_move_alternate = []
num_enemie = 5
for i in range(num_enemie):
enemie_ship.append(pygame.image.load('enemie_ship-64x64.png'))
enemieX.append(random.randint(0, 736))
enemieY.append(0 - random.randint(60, 70))
enemieX_move.append(1)
enemieY_move_alternate.append(40)
def enemie(enemieX, enemieY, i):
screen.blit(enemie_ship[i], (enemieX, enemieY))
Hey,
Everytime I click on a file, and then click download, it doesn't download.
Please help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.