- Ballz in Python 3 with Pygame
- 13 May 2017 03:20:49 pm
- Last edited by Kydapoot on 12 Jun 2017 05:01:26 pm; edited 1 time in total
(The thread is now renamed)
I am trying to make a pygame clone of the Ballz game where you aim and shoot a bunch of balls to knock out blocks of different strengths. I can aim and shoot balls, but I have one problem: only one ball can move at a time. One shoots, and when it's finished the next one starts. This would get real boring real quick. They are all supposed to shoot in sequence in a stream. But they also must move independently, because when a ball destroys a block the following balls that would have hit it will have a different path.
But first things first, this is my list:
Code:
Each 4-element list represents a ball. The first two elements in each ball are its x and y coordinates, and the next two are its speed on the x and y axes.
So here is the goal: For now, I'm not worried about them moving in sequence. I want to change the first and second elements (position) of every ball based on the third and fourth elements (its direction). In the above example, the end product (after 1 iteration) would be:
Code:
OR: If you happen to know how to achieve the behavior of the balls in Ballz a different way, please explain it.
I am trying to make a pygame clone of the Ballz game where you aim and shoot a bunch of balls to knock out blocks of different strengths. I can aim and shoot balls, but I have one problem: only one ball can move at a time. One shoots, and when it's finished the next one starts. This would get real boring real quick. They are all supposed to shoot in sequence in a stream. But they also must move independently, because when a ball destroys a block the following balls that would have hit it will have a different path.
But first things first, this is my list:
Code:
[ [12,15,1,3], [5,73,2,2], [23,9,3,1] ]
Each 4-element list represents a ball. The first two elements in each ball are its x and y coordinates, and the next two are its speed on the x and y axes.
So here is the goal: For now, I'm not worried about them moving in sequence. I want to change the first and second elements (position) of every ball based on the third and fourth elements (its direction). In the above example, the end product (after 1 iteration) would be:
Code:
[ [13,18,1,3], [7,75,2,2], [26,10,3,1] ]
OR: If you happen to know how to achieve the behavior of the balls in Ballz a different way, please explain it.