Skip to main content

Defender - 0.04

defend the earth


josmiley / Luke spywoker
(mutualaccount)
no sound, no score, only able to move the ship and shoot face some enemy attacks
wink to SPACEMAX(si ça ne t'embête pas)

Links

Home Page
http://www.pygame.org/project-Defender-2903-4751.html
Source
https://www.dropbox.com/s/i5uozdl9ccvlcn5/defender.zip

Releases

Defender 0.02 — 11 Jun, 2014

Defender 0.03 — 14 Jun, 2014

Defender 0.01 — 9 Jun, 2014

Defender 0.05 — 24 Jun, 2014

Defender 0.04 — 21 Jun, 2014

Pygame.org account Comments

  • brantcgardner 2014-06-11 20:41:35

    That is really very good. The graphics are smooth and clean with an interesting blur effect on the 'bullets', and the ship motion is fluid and natural. Keep going, I'd be interested to see where you wind up with this.

  • Eddie Bruggemann 2014-06-12 19:15:33

    I get a traceback:

    Traceback (most recent call last):
    File "run.py", line 77, in <module>
    Game.run()
    File "run.py", line 30, in run
    Game.clear(level)
    TypeError: unbound method clear() must be called with Game instance as first argument (got type instance instead)

    by executing run.py

    I run on Ubuntu 12.04.

    Pretty images in the archives, it seems tey are performed with a pixeling programm but wenn i open it with kIconEdit an pixeling image creation programm, there are many pixels values with an significativ alpha value, maybe you generate it with our loving python game module...

    josmiley 2014-06-12 20:56:32

    this game only works with python 3, I do not succeed to solve the problem with python 2.

  • brantcgardner 2014-06-12 20:49:52

    Are you running this under Python 3 as indicated in the description? I'm on Xubuntu 13.10 and it worked for me right away.

  • spacemax 2014-06-23 21:38:59

    Salut Jo,

    J'ai pas python 3, alors j'ai testé sur mon environnement linux Jessie / python2.7...

    Au lancement :

    ERREUR 1

    from .ship import ship

    File "/home/max/documentations/python/sources/python/defender/lib/ship.py", line 95

    SyntaxError: Non-ASCII character '\xc2' in file /home/max/documentations/python/sources/python/defender/lib/ship.py on line 95,

    but no encoding declared; see http://www.python.org/peps/pep... for details

    Statement : LAZERTEXT = police.render('LAZER°',1,(250,250,250))

    Résolue par ajout de la directive dans ship.py / solved by added

    #!/usr/bin/env python

    # -*- coding: utf-8 -*

    ERREUR 2

    File "/home/max/documentations/python/sources/python/defender/lib/levels.py", line 59, in update

    Level1.v[0]()

    TypeError: unbound method v1() must be called with Level1 instance as first argument (got nothing instead)

    Résolue par ajout de @staticmethod devant toutes les methodes de levels.py / solved by added @staticmethod before all methods :

    #!/usr/bin/env python

    # -*- coding: utf-8 -*

    from pygame import time

    from random import randint

    from .enemy import Red,SMAlien2

    from .enemi import enemi

    from .shotenemi import shotenemi

    from .shotami import shotami

    from .ship import ship

    from .background import Background as bg

    class Level1(object):

    @staticmethod
    def v1():[...]

    @staticmethod
    def v2():[...]

    @staticmethod
    def wait():[...]

    @staticmethod
    def update():[...]

    @staticmethod
    def clear():[...]

    Après, le jeu tourne sur Python 2.7.

    Personnellement, je trouve les graphiques sympa. Les tirs des aliens ainsi que les explosions sont vraiment réussis. Par contre, j'aime pas du tout le déplacement du vaisseau que je trouve enervant car on est obligé de réajuster sans cesse la direction...

    Sinon, je veux bien une petite explication sur les lignes suivantes car je connais pas la technique employée...Enfin si c'est pas trop compliqué ;)

    level = __import__('lib.levels',None,None,[levelname])
    level = getattr(level,levelname)

    a+

    josmiley 2014-06-24 07:30:55

    salut max,
    merci pour la correction, certaines animations ne fonctionnaient plus avec p2 mais c'est aussi corrigé (problème de divisions entières).

    mon_import_dynamique = __import__('mon_module',None,None,['module1','module2','etc...'])
    mon_alias = getattr(level,'module1')

    revient à écrire de façon dynamique

    from mon_module import module1 as mon_alias, module2, etc...

    ça m'évite ainsi de charger tous les levels d'un coup même s'il pour le moment il n'y en a qu'un.
    je les charge au fur et à mesure.