Nice entry Andy! Keep’em comming.
Although you said you dont have initialization code in your libraries, I guess you were referring to library initialization code. My initialization code (graphics, sound, etc) tends to end up in my utilities library exactly because of what you just said: dont repeat code.
When I was talking about initialization stuff, I mean like… To use Flixel or Flashpunk, you first have to call a base game object, then start building on that and using those methods.
My libraries are all distinct functions that don’t require “setup”; you just use them as-needed. I guess it’s the difference between using an enclosed *system* vs. using *tools*.
I haven’t used those two libraries so I won’t use them as an example, but here’s one from Box2D. Let’s say we want to make a box fall with gravity on the screen.
With Box2D:
Install the package;
include the library;
create a box2d scene;
define the world constants;
define the box;
be sure to include weight, friction, density, air density, and all those figures;
hit run;
hope that everything works ok, and despair at you not being able to directly set X/Y coordinates of the box as they are private in Box2D.
With my library:
Include my “tools” folder;
create a square sprite;
call sprite.addGravity(9.81);
box starts falling, and all other properties are still easily used.
(repeat if you want to add friction or air resistance or such)
Nice entry Andy! Keep’em comming.
Although you said you dont have initialization code in your libraries, I guess you were referring to library initialization code. My initialization code (graphics, sound, etc) tends to end up in my utilities library exactly because of what you just said: dont repeat code.
When I was talking about initialization stuff, I mean like… To use Flixel or Flashpunk, you first have to call a base game object, then start building on that and using those methods.
My libraries are all distinct functions that don’t require “setup”; you just use them as-needed. I guess it’s the difference between using an enclosed *system* vs. using *tools*.
I haven’t used those two libraries so I won’t use them as an example, but here’s one from Box2D. Let’s say we want to make a box fall with gravity on the screen.
With Box2D:
Install the package;
include the library;
create a box2d scene;
define the world constants;
define the box;
be sure to include weight, friction, density, air density, and all those figures;
hit run;
hope that everything works ok, and despair at you not being able to directly set X/Y coordinates of the box as they are private in Box2D.
With my library:
Include my “tools” folder;
create a square sprite;
call sprite.addGravity(9.81);
box starts falling, and all other properties are still easily used.
(repeat if you want to add friction or air resistance or such)