How to make Doom fire with Pygame

This video shows how to make the fire that was used in the playstation version of Doom back in the days with python and the module pygame.

To install pygame

pip install pygame

If you have python 3.11, at the moment, you can install pygame like this

The class App has 3 methods, udpdate, draw and run

You run the class with the method run() of the istance app.

These statements are used to display the framerate into the window caption

There is another class for the fire called DoomFire

Then create an istance of the DoomFire class into the __init__ of the class App and call the update method of this istance into the update method of the class App and call the method draw of doom_fire into the draw method of app.

These are the colors of the flames

let’s make a list with the colors

This are the methods for the palette of colors

This method is called in the draw method of doom_fire

Launching the program you’ll see this

Now we create an array with the above shape to show the fire

This is for the fire size

Now we need to make the fire go up

The do_fire method is called by the update method

we get a static picture now
this adds natura spreading of flames
It’s nice
Increasing the resolution the frames per second drops
the frame rates rises but not that much

The frame rate is back to 62.5 fps

The effect in the game
Make the black transparent color for the doom title image
This will load and position the image
call the method into the doom_fire draw method

[hoop name=”all”]

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.