29 Jan 2014 @ 10:28  

Komando Python.

Capture d’écran :

capture006

capture007

Code source :

https://github.com/Nekrofage/KomandoPython

Posted By: Administrateur
Last Edit: 29 Jan 2014 @ 10:38

EmailPermalinkComments (0)
Tags
Tags: , ,
Categories: Jeux Vidéos, pyGame, Python
 29 Jan 2014 @ 10:14  

3d point sphere rotation.

Vidéo :

Image de prévisualisation YouTube

Code source :

https://github.com/Nekrofage/Sphere3dPoint

Posted By: Administrateur
Last Edit: 29 Jan 2014 @ 10:14

EmailPermalinkComments (0)
Tags
Tags: ,
Categories: Graphisme 3d, pyGame
 13 Nov 2013 @ 10:22  

Problem of integration of pgu (http://code.google.com/p/pgu/) module to pyGame (http://www.pygame.org/).

Question:

On your game « PyOrg », you use the pgu (http://code.google.com/p/pgu/) module for the graphical user interface. I would like to do the same thing for my own game (https://github.com/Nekrofage/KomandoPython). But I have a problem to integrate the gui to the pygame. To explain my problem, I have this archive : http://nekrocite.info/python/pgu.zip
where there are the move_sprite_keyboard_smooth.py example file and the same file : sprite_smooth.py with the pgu.
When I move the sprite the movement is very strange, the movement is not fluid
For the first example, if I press down the right key all the time the sprite movement if okay. But for the second example, the sprite movement become more and more quickly

Answer from Marcus Møller creator of pyORPG (http://www.powrtoch.org/pyorpg/) :

A little trial and error shows that this behaviour is caused by app.init(c) on line 102-103.
When looking through the source of PGU, you’ll find the app.init() function in file pgu/gui/app.py. In the app.init() function you’ll see that this pygame function is being called:
line 104: pygame.key.set_repeat(500,30)

This tells pygame to repeat event keys 30 times with a delay of 500 ms.

So that leaves you with two options for fixing your problem:

(Worst option) You can comment out line 104 in pgu/gui/app.py so that the pygame.key.set_repeat() function isn’t called on app.init(), or
(Best option) set a limit for the player velocity.

The best gamedesign-wise option is to limit the velocity of the player. This is easily done by adding the following lines to the top of your player.update() function:

if self.change_x > 3: self.change_x = 3
elif self.change_x < -3: self.change_x = -3 if self.change_y > 3: self.change_y = 3
elif self.change_y < -3: self.change_y = -3 These few lines limit the velocity of your player. If you comment out line 104 in pgu/gui/app.py, you'll risk breaking PGU. PGU won't be able to have key repeats in text boxes etc., requiring users to re-press the "d" buttons if they were to enter "ddddddddddddddd" in a textbox.

Posted By: Administrateur
Last Edit: 13 Nov 2013 @ 10:22

EmailPermalinkComments (0)
Tags
Categories: pyGame, Python

 50 derniers articles
 Retour
Changer Thème...
  • Users » 1
  • Posts/Pages » 532
  • Comments » 1
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

SteamCyberPunk



    Pas de Pages Enfants.

Discussion



    Pas de Pages Enfants.

Galerie Photos



    Pas de Pages Enfants.

Manifestations et festivals



    Pas de Pages Enfants.

Concerts et festival de musique



    Pas de Pages Enfants.

Articles



    Pas de Pages Enfants.