Skip to main content

Cargo Carrier

While flying your Millennium Falcon (original, right?), collect cargo while out-maneuvering and destroying asteroids.


Brock Glaze
(bglaze)
I used Python 2.7 and Pygame to create this game. You will need both of them installed to run the script. However, you shouldn't need anything else. Any suggestions or comments are very welcome! Collect cargo crates and warp to more difficult zones. You have 1 life, and the max level is currently set to 10. Can you win? I, the creator, have yet to get past level 8, but maybe you can!

Links

Home Page
http://www.pygame.org/

Releases

Cargo Carrier 1.1 — 12 Sep, 2011

Cargo Carrier 1.12 — 13 Sep, 2011

Cargo Carrier 1.13 — 15 Sep, 2011

Cargo Carrier 1.0 — 11 Sep, 2011

Pygame.org account Comments

  • }

    Jouni Järvinen 2011-09-11 15:48:24

    Nice game, works fine on Lubuntu 1104 64. If you don't mind, I have few words about the code.

    cargo_carrier.pyw:
    1) Especially since you're coding with Py27 (although it works fine with 26 too), you can use Ternary Conditonal Operation for less lines and a bit faster code. Lines 31-34 can be replaced with §return asteroid_dict if asteroid.lower() == 'dict' else asteroid_dict[asteroid]§ or §return (asteroid_dict if asteroid.lower() == 'dict' else asteroid_dict[asteroid])§ depending on which is clearer to you.

    ccfuncs.py:
    1) Lines 165-170 are replacable like in the main file above.
    2) Line 282: always use §print§ as a function like §print()§, to be compatible with Py3.

    colors.py:
    1) Line 56: always use §print§ as a function like §print()§, to be compatible with Py3.

    And a feature request: depending on the asteroid's size, you can either take many hits or few hits or one hit before blowing up; in respect of small, medium and large asteroid. If you implement this, of course a health meter is almost a must.

  • }

    g30c0d3r 2011-09-11 19:55:34

    Jouni,

    Thank you for the advice. I REALLY appreciate the input about the code. I am going to change that asap.

    Also, I appreciate the advice on functionality, and I love the
    suggestion. My wife actually commented that it's weird that the smaller
    rocks are just as destructive as the biggest rocks. So, I am going to
    implement shield power (ie health bar), and different damage depending
    on rock size.

    Thanks again for your input! Hopefully I'll have the new version up as soon as I get some free time to add those things.

  • }

    Jouni Järvinen 2011-09-12 09:45:50

    v1.1 good as well :)

    }

    g30c0d3r 2011-09-12 17:28:01

    Thank you!

  • }

    Brian Zimmerman 2011-09-20 16:38:35

    No matter what version of Cargo Carrier I try, I get the following error:

    Traceback (most recent call last):
      File "cargo_carrier.pyw", line 555, in <module>
        if __name__ == '__main__': main(1, 9999, 40)
      File "cargo_carrier.pyw", line 302, in main
        icon = ccfuncs.load_image('data/icon.ico', True)
      File "C:\Documents and Settings\zimmeb5\My Documents\Downloads\Cargo_Carrier\ccfuncs.py", line 292, in load_image
        image = pygame.image.load(file_name)
    pygame.error: Unsupported image format

    Is there something I need to get Pygame to display .ico images?

    }

    Jouni Järvinen 2011-09-20 16:46:51

    It'll work out-of-box, meaning there's something wrong with either your system or the file.

    }

    Brian Zimmerman 2011-09-20 21:20:33

    Yes, I'm sure it is a problem with my system. It might be that I am using Python2.5 on windows, I need to because I can't get pygame running with python27in windows (I don't have this problem with Linux). I saved icon.ico as icon.png with GIMP, and changed line 302 in cargo_carrier.py to read data/icon.png, and everything works great. Hurray for open source, and thanks for a really fun game!

    }

    g30c0d3r 2011-09-20 22:17:07

    Thanks, I went ahead and changed this in the main project as well that way others don't run into the same issue. The icon is now a PNG.

    }

    Brian Zimmerman 2011-09-27 16:29:42

    By the way, in case anyone was curious, I was able to get Pygame working with Python 2.7 in Windows, ran the original cargo_carrier and had no problems, so somehow .ico image format does not always work in Pygame pygame-1.9.1release.win32-py2.5.exe

    }

    Jouni Järvinen 2011-09-27 16:31:54

    So does that mean that Cargo Carrier works with Py 2.5 ?

    }

    Brian Zimmerman 2011-09-28 04:40:41

    Yes it does, as long as the ship is not an .ico image.

  • }

    Jouni Järvinen 2011-09-27 16:58:13

    FEATURE REQUEST:
    - Hardcore mode. You die once, you start from the beginning like you started for first time.
    - Total n00b mode. You can't die and you can shoot like there's no end.

    I think there are too many asteroids at once.

  • }

    Juan 2013-06-18 23:55:35

    my computer is a PIV with xp sp 3, 512mb ram and gforce2 mx 400, i can not run the game......

    Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
    Traceback (most recent call last):
    File "C:\Documents and Settings\Juan\Escritorio\CargoCarrier-9-15-11-script\cargo_carrier.pyw", line 315, in <module>
    game = Game()
    File "C:\Documents and Settings\Juan\Escritorio\CargoCarrier-9-15-11-script\cargo_carrier.pyw", line 32, in __init__
    self.icon = pygame.image.load('data/icon.ico')
    error: Unsupported image format

    but runs fine in the same computer with xubuntu 12.04

  • }

    vadash_bengals 2014-06-06 06:01:56

    click on link, but it doesnt work. HELP!!!