# Making a brick breaker in OOP

**URL:** https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608
**Category:** Processing.py
**Tags:** homework
**Created:** [January 13, 2022, 12:01pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608 "2022-01-13T12:01:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Antoine](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Antoine](https://discourse.processing.org/u/Antoine)
#### Post date: [January 13, 2022, 12:01pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608/1 "2022-01-13T12:01:38Z")

</div>

Can someone pls help me making my homework which is to do a brick breaker game in class (POO) in python. I have to do multiple levels and I cannot figure how to do that.  
This is what I have already done:  
For the game itself : [# FONTCION DE BASE from paddle import Paddle #import de la classe Paddle - Pastebin.com](https://pastebin.com/SsZTf3aS)  
For the ball, the paddle and the brick : [# coding=utf-8# OBJET BRICKclass Brick(): #attribut de classe un dic - Pastebin.com](https://pastebin.com/DQLQEQuu)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 13, 2022, 1:16pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608/2 "2022-01-13T13:16:39Z")

</div>

I think that’s OOP (object oriented programming)

😉

---

<div class="post-metadata">

### Author: ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)
#### Post date: [January 13, 2022, 9:13pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608/3 "2022-01-13T21:13:17Z")

</div>

Welcome @Antoine

Best to move this question to the _Processing.py_ category.

Perhaps a structure like this might work?

```python
levels_data = [
  ['blue', 'green', 'orange'], # level 0
  ['pink', 'green', 'red'], # level 1
  ['red', 'red', 'blue'], # level 2
]

level_number = 0

def setup():
    size(600, 400)
    for brick in levels_data[level_number]:
        print(brick) # render the bricks for the level
    print('---')
    
def draw():
    background(0)
    # all of your game logic ...

def keyPressed():
    # advance a level (using a key-press for this example)
    global level_number
    level_number += 1
    setup()

```

---

<div class="post-metadata">

### Author: ![Antoine](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Antoine](https://discourse.processing.org/u/Antoine)
#### Post date: [January 13, 2022, 9:17pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608/4 "2022-01-13T21:17:30Z")

</div>

Yes, sorry because I am french and in french is Programmation Orienté object.

---

<div class="post-metadata">

### Author: ![Antoine](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Antoine](https://discourse.processing.org/u/Antoine)
#### Post date: [January 13, 2022, 9:18pm UTC](https://discourse.processing.org/t/making-a-brick-breaker-in-oop/34608/5 "2022-01-13T21:18:17Z")

</div>

I’ll tomorrow and I’ll tell u. Thanks  
If u are available to voc and try to improve my program this will be so goood.
