|
||||||
| Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi,
I am fairly new to game programming need some help with the logic of how to "generate a simple "skyline background" of buildings with different sizes. Each time the program is launched, it should generate buildings of different sizes. I need help with the logic of doing this, how should I generate buildings inside the screen, define limits, and so on. And what would be the easiest way to do this? Should I use images for this or is it easier to generate rectangular shapes? Thanks a lot in advance. |
| Sponsored Links |
|
|
|
|||
|
Ok, what I would do, a 2 layer background, the sky and the buildings.
You could have premade clouds/stars or whatsoever, that are positionned randomly(It doesnt matter if a cloud is drawn on another) For the buildings you could either generate each building(relatively hard), or you could have a series a pre-made buildings with known width. So all you'd have to to is take one randomly (something like random.choose(list) -> returns a picked element from the list), make sure its not the same than the last, and then blit it("draw" it if you're not familiar with pygame) after the preceding one. You could draw them until lets say 50 pixels after the right end of the screen, so you can scroll your background, from left to right I guess, and when the hidden 50 pixels are scrooled, you just "append" 2 or 3 new buildings. (without forgetting to remove the "old" buildings on the left) If you need more explanations, ask, I'll try to answer! |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tournament Generate | Whitey | PHP Forum | 6 | 08-28-2008 06:58 AM |
| Help with Background Image! | PascalPro | Visual Basic Programming | 5 | 06-24-2008 08:09 AM |
| Generating random background... | bentoh | General Programming | 5 | 01-24-2008 08:47 AM |
| What do you think of Pygame? | monkey_instinct | Python | 3 | 01-03-2008 12:44 PM |
| Generate text with transparent background | AfTriX | PHP Tutorials | 1 | 01-08-2007 03:13 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |