New answers tagged

0

A background really isn't anything but an image that you draw before anything else. The easiest way to do that is to import the image using image.load() and save it to the variable background. After doing that create a new variable background_y that saves the position of where the background is. After that, go to your update function and decrement ...


0

As far as I see it the Shop class (for example) needs dependencies on at least two classes: The current status of the player-character (things like available money, inventory and what quests they are currently on) The current status of the shop the player is visiting (things like shop inventory, prices and available quests) These dependencies must be ...


0

I wrote this in C#, but It has the same idea, and can be taken as pseudo code. Because in pong you're only dealing with rectangles and not polygons, it makes collision detection and response fairly easy. In C#, the .NET 4.5 framework already has a method at allows you to check if a rectangle is intersecting (touching) another rectangle. (Keep in mind that ...


1

The idea behind infinitely scrolling backgrounds is pretty simple. You simply draw the background enough many times to fill the screen, and once a piece of the background moves off screen, you loop the rendering and start back from the beginning. So, the basic functionality would go as follows: (pseudo code, should be easily adaptable to PyGame) piece = ...



Top 50 recent answers are included