Categories
- Blog (104)
- Lua (13)
- Miscellaneous (48)
- Photos (6)
- Programming (33)
- Python (15)
- Sample (3)
- Web Design (3)
- Writing (2)
- Portfolio (40)
- Snippets (28)
- Blog (104)
Monthly Archives: October 2009
Primitive Collision Detection – Circular objects
Consider the following –
If you are designing a game, and have the players shaped as circles, how would you detect bullet collisions with the players?
Well, the problem with bullet collision detection is that you can’t just use…
Posted in Blog, Programming, Python, Snippets
Leave a comment
[Python] Get Function Args
getargs = lambda func: (func.func_code.co_varnames[:func.func_code.co_argcount])
Example Session
#Example Session
getargs = lambda func: (func.func_code.co_varnames[:func.func_code.co_argcount])
def addition(x,y):
return x+y
print getargs(addition)
#('x', 'y')
Yep, it’s really that simple. No weird exec functions needed, no intrusive introspection via the disassembler.
Posted in Blog, Programming, Python, Snippets
Leave a comment
Cute Functions – Creating pseudo-operators in Python
I ran across something today that I found to be extremely interesting. Basically, the authors of Should_DSL, http://pypi.python.org/pypi/should_dsl/1.2.1, have attempted and succeeded in creating pseudo-operators based on operator-functions within an object.
Let me elaborate.
The goal of Should-DSL
…
[Lua] MapParser (High Level API)
This is a Map parser library for CS2D’s lua engine. Benchmarked to process 6,000 tiles per second. (A 2,000% improvement over the older parser). This also demonstrates that it is possible to have object-orientation within a lua script
…
Subversiv… eh, Green Coding
We developers usually aren’t all that political. But we have our own little sphere of influence. My friends, the nerd community is a very open one, and we’re usually the type to peer-review each others works and thought…
Posted in Blog, Programming
Leave a comment
