Monday, March 3, 2008

Python

Everyone seems interested in my new Python version so here it is. No one every seemed too interested in my Java source code. Maybe Python is more fun?

The GUI requires Pyglet but all you can do is to move a card. And you have to make sure there is a file called "card.jpg" in the gui directory. The only thing that really works is ManaCost, everything else is in its very early stages. The Card class holds one or more SpellAbility classes. Each SpellAbility has a resolve() method that is called when it is popped off the stack and resolves.

Python Source Code:www.mediafire.com/?rjnzzdvnmy1
Pyglet Graphics Library:pyglet.org

6 comments:

Unknown said...

Thanks for posting the code. For the record I was interested in the Java code, but this looks from what you've said to be a better solution.

I loaded pyglet (in linux) to try out your new gui. I think that you need more than "card.jpg" for the gui to work because it claims that "blank.gif" is also missing. I also had a problem with the font but it's too early to look at that I guess. I was surprised how small pyglet was.

Will each and every card have it's own class, or will you allow people to add cards using the 'cards.txt' file like you do now? Or is it easy enough to load those cards as individual classes?

I'm looking forward to seeing how this progresses, keep up the great work.

Nanocore said...

pyglet? Bummer, I was hoping your first cut of the GUI for the python version wouldn't require an opengl based library. I would love to take this on the road with my tablet which doesn't have support for opengl. I was working on a few things with pygame that I was hoping to add to get version 2 to run on my tablet. Not that I expect this, but I might still be able to do this if the display code is not to tightly coupled with the code.

Unknown said...

Out of interest, are you still maintaining the Java version and writing new code for it, or have you moved completely to the Python version?

Forge said...

I've posted more complete Python code here www.mediafire.com/?rjnzzdvnmy1 Hopefully you can get my basic gui working.

Yeah I like Pyglet too. You can resize the graphics window and everything seems prettty smooth. The docs are pretty good too but way over my head.

>Will each and every card have it's own class, or will you allow people to add cards using the 'cards.txt' file like you do now?

I plan on using cards.txt since it allows "simple" cards, like Serra Angel, to be added with no programming. And I'm always for less programming. :) Anything more complicated will have its own separate class. In the new source code, Bottle Gnomes and Lava Spike show how I plan on programming cards.

Forge said...

Sorry Nancore, I am planning on the GUI being totally separate from the rest of the code in case I or someone else wants to write a different GUI. I don't really know what graphics library to use so I just picked one randomly.

About updating the Java version. I update it whenever I feel like it. If I really want a new card, I'll try to program it, but otherwise it is kind of dead.

Nanocore said...

No problem. I will still continue to work on a what I am working on for when you reach that point when the display is not tightly coupled with the core code. And, enjoy the fruits of version 2 on my Linux PC when I don't want to code!