Jump to content

  • Log In with Google      Sign In   
  • Create Account

PaladinJohn

Member Since 28 Mar 2009
Offline Last Active Jan 16 2013 11:46 PM

Posts I've Made

In Topic: Pausing Python (or causing a delay)

10 July 2012 - 02:14 PM

Just wanted to post an update saying that I discovered the issue after getting some sleep. The delay was working just fine, but I had made the mistake of forgetting to call this lovely block of text before the pygame.display.update()
[source lang="python"]self.allSprites.clear (screen, self.background)self.inactiveSprites.clear (screen, self.background)self.allSprites.update()self.inactiveSprites.update()self.allSprites.draw(screen)self.inactiveSprites.draw(screen)[/source]
After giving it it's own function and a minor tweak to the code I got it to work as intended. Thank you to any one that might have been puzzling over this.

In Topic: Linking Images on a Grid

06 March 2012 - 06:07 PM

Sorry to bump this, but I'm still trying to work through this issue.

Do you think that perhaps if I passed the entire Object onto the grid rather than the number that corresponds to the particular element, that might work? That way I could use the Direction of the sprite to tell if two objects next to each other are linked. Of course, doing that means I would have to seperate the sprites into two halves to properly load an image onto the grid. Unfortuantely, I don't know how I would continue to register the two seperate sprites as one entity other than perhaps making it a sprite group in which case I would probably have to scrap everything I have and redesign the program for a fourth time from the ground up and I'm hesitant to do that when I'm not even sure that my idea will work properly.

I know programming isn't supposed to be an easy process, but I can't help but feel that I'm doing things terribly innefficiently and taking unnecessary steps to accomplish something very simple. More so, I'm worried that there isn't a lot of information out there to bridge the gap from beginner to intermediate when it comes to game programming in Python. I can find tons of beginner examples that I know and understand but don't come close to performing the tasks I need, but every thing above that seems to be using advanced techniques that are performing tasks far above my current skill level. I'm hesitant to ask, but perhaps should I try a different programming language since I seem to have gotten stuck in the mud with Python? C# seems to have much better community support and documentation and is widely used. I chose Python because I liked the syntax and the logic was very easy to follow compared to my previous forays into programming. If any one that has started with Python as their first step into serious programming can give me a little insight on how they managed to overcome the hurdle in making the jump from beginner to intermediate I would appreciate it.

In Topic: Python - Issue regarding custom Game Engine

28 October 2011 - 07:55 PM

Not sure if any one was following this post, but after three days of staring at my screen, I finally found a solution to the problem.

I wanted to modify the original Engine as little as possible, but I found it impossible to achieve the results I was looking for without it. Essentially, I added another variable cumGrav to track the cumulative effects of gravity during each frame. If a sprite does not check for gravity, it will have no effect. I guess now that I've figured that out, I do have a more general question in regards to Engines:

Is it normal to have to tinker with engine code to get something to work properly?
Was the engine I was working with just extremely narrow in focus and literally made it impossible to properly code my games with it alone?
Am I missing some trick of the trade that gets an engine to do what you want it to when the code in the engine does not?
Finally, are all engines this frustrating to work with compared to working without, or will the more popular engines make coding easier in every regard?

Thank you for any who spent some time pondering my coding dilemma before I found the answer.

In Topic: Python - Issue regarding custom Game Engine

27 October 2011 - 10:34 AM

After sleeping on it, and looking at it again, I think I've found what the problem with the program is. Mainly, the SuperSprite's update() method contains both __calcVector() and __calcPosition(). In the original program, __calcVector() is only called once at the initialization of the fire() function, while __calcPosition() is called every frame. In this program, both are called every frame making any changes to dy irrelevant as it gets over written when __calcVector() is called again in the next frame.

My new question is, since they're both private functions in update(), is there no way to over write them, meaning the game is impossible to program with this engine, or is there some technique I do not know yet that might help me get the effect I'm looking for?

In Topic: Problem creating an .exe with py2exe

13 August 2011 - 08:32 PM

I got it to work! I'll detail what I did here so if any other clueless beginner stumbles upon these same errors and does a google search, they might be able to compile their game without any issue:

Firstly, to fix the _view problem, I was forced to put the following line of code into my main program (not the setup.py program) in order to call the _view.pyd so that py2exe actually finds it:

import pygame._view

That line of code has absolutely no effect on the program itself.

Afterwards, I kept getting font errors despite making sure to include the font in the list of files. A brief search of the internet helped me to narrow down exactly which part of pygame's py2exe script was responsible for fixing the issue with the font, as well as the sound which was a problem I ran into afterwards. Simply copy/pasting the code from the script did not work, and instead thanks to some advice from the following blog: http://thadeusb.com/...font_and_py2exe I edited my setup.py script appropriately. (Please remember to import os in your setup.py script!)

Here is the final setup.py program I wound up with:

from distutils.core import setup
import py2exe, os

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
	if os.path.basename(pathname).lower() in ("sdl_ttf.dll", "libogg-0.dll"):
        	return 0
	return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

setup(console = ["footBallHell.py"],
  	author="XXXX",
  	author_email="XXXX",
  	data_files=[('.', ["attack.ogg",
                 		"enemy.gif",
                 		"Field.gif",
                 		"football.gif",
                 		"player.gif",
                 		"save.ogg",
                 		"tackle.ogg",
                 		"freesansbold.ttf"]
           		)]
  	)

PARTNERS