0

[SOLVED] How to make multiple bullets (with png) and move at similar time by using Pygame?

I have been making a boss fight with Pygame, I made the boss move by the edge, and change the direction by changing a var called phase, and the boss will make bullets while moving, however I just could make 1 bullet and only 1 direction. I need help. (btw I can't give the code in the comments because I only use Sololearn on phone)

29th Feb 2020, 3:27 AM
Chaney Chan
Chaney Chan - avatar
7 ответов
+ 3
i think it comes down to your code design, you should create multiple bullet objects on each game loop to instantly create multiple bullets at the same time. and create another method to enable the bullet to move at a certain degree or direction. we still can't help you much if you don't provide the codes that you are referring to.
29th Feb 2020, 7:57 AM
Shen Bapiro
Shen Bapiro - avatar
+ 2
Without code it would take many questions and answers to just get an idea of how your code works. It is best to post your code if you want a good and reliable answer. You can connect to your SoloLearn account on your computer, and then copy-paste the code.
29th Feb 2020, 3:40 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
你的make bullet function 裡有要有一個dictionary ,不同的phase會引發不同的子彈方向。 如果還不明白,我可以在這裡用JavaScript 做一個簡單的示範 (或者將你的source放上github,將github repo的link share在這裡)
29th Feb 2020, 3:43 AM
Gordon
Gordon - avatar
+ 1
lvl 1 crook Thanks, I have solved the problem!
29th Feb 2020, 9:29 AM
Chaney Chan
Chaney Chan - avatar
+ 1
awesome Chaney Chan , happy to help :)
29th Feb 2020, 10:29 AM
Shen Bapiro
Shen Bapiro - avatar
0
I think I might post part of the bullet code soon
29th Feb 2020, 4:50 AM
Chaney Chan
Chaney Chan - avatar
0
lvl 1 crook l think that you are right, I will try it soon when I get my hands on my pc.
29th Feb 2020, 8:02 AM
Chaney Chan
Chaney Chan - avatar