Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Stupid, Clever, or Both?

Name: Anonymous 2007-10-24 2:02

I'm doing some expert programming of a tile-based game in which tile classes have references to anonymous functions that return the proper image for that tile. I figure I might as well not duplicate these. Should I make these functions onymous or just have a picture function manager that lets me get at them easily? It would be dead simple to create onymous functions for them at runtime, but it makes me feel funny to do it.

Name: Anonymous 2007-10-24 9:11

>>5
That's basically my >>4, only you nigger handle it from all functions together, so instead of

img = GetSprite('image.png')

you do

sprites.setdefault('image.png', LoadImage('image.png'))

and flushing becomes insecure. I prefer the former way, as it's shorter to use, abstracted in a function (implementation details hidden, can change anytime) and is safe to flush. But it's another good way to do so.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List