ArkaPyGame 2.1 – Arkanoid like game made with Pygame

In this version of Arkapygame, the clone of arkanoid (made just for learning purpose) we tried some new things.

Refreshing the screen

As you already know, to avoid leaving traces of the sprites blitted on the screen we need to clear the screen in some way.

Instead of using screen.fill((0, 0, 0)) every frame rate to clear the screen or using an Image in the background blitted every frame rate, we could replace only the piece of background behind the sprites that are moving, so that they are deleted and then re-blit the sprite in the new position. This would benefit the frame rate per second.

In this case I choose a little different approach. Instead of replacing the space “behind” the sprite, I just changed it’s color to black (the color of the background) and then blitted again the sprite (in this case, the only moving objects are the ball and the bar.

I did the same for the bricks, but, as they do not move, but they only disappear when they are hit (and no other object goes over them), I decided to blit them in black when they are hit, to delete them. Also the score is deleted only when the score increases and not every frame. So for the most of the time we have just a black bar and a red bar blitted and a black ball and a red ball blitted every frame rate, a very little thing to do for the cpu I think.

In the next post I want also to blit the bar and the ball at the same time to save even more speed, so stay tuned.

The code is the following. I will make a full explanation of the code soon with a live video.

New sounds

As sounds are important, I personally remade all the sounds so that they are more appealling.

The game

The code

Github repository

1.1 – Pong the father of Arkanoid

Pong v. 1.0 – Pygame example

1.2 – Starting arkanoid… from pong

Arkanoid… let’s make it better…

1.3 – Adding background

ArkaPyGame 1.3 – Adding a background

1.4 – Collision detection

ArkaPygame 1.4 – Collision detected

1.5 – Bricks collisions

Arkanoid in pygame part 5

1.6 – Still on Collisions

Arkanoid part 6 – Still on bricks collision

1.7 – Fixed strange bouncing

Arkanoid 1.7 – Fixed strange bouncing

1.8 – How to destroy the bricks

Arkanoid 1.8 – First stage almost complete: destroy bricks

1.9 – More levels

Arkanoid 1.9 – more stages

2.1 – Infinite level generator

Arkanoid 2.0 – infinite levels

2.3 – Sounds and faster frame rate tecnique

ArkaPyGame 2.1 – Arkanoid like game made with Pygame

2.5 – New nicer levels simmetric and in color and menus

Arkanoid-Pygame 2.5 – New levels and menu

2.6 – Keyboard control

ArkaGame 2.6 – Adding keyboard commands

2.7 – Mouse exclusive control

Arkanoid 2.7 with Pygame – Mouse control

2.xxx – Tiny version

TinyArka – “Mini” version of Arkanoid with pygame

5.0 – Arkagame: 5 different versions

Breakout / Arkanoid – 5 versions in one (pygame)

Github repository
https://github.com/formazione/arkapygame


Subscribe to my youtube channel

Other Pygame's posts

Tkinter test for students

Tkinter articles

Utilities

Python and Powerpoint


Pdf made with Python