>>21079
It's pseudocode that switches on strings. That takes more effort to write than pseudocode which doesn't, you went out of your way to do so.
switch (collision.type) {
case(ENEMY):
//lose HP, &c.
case(IMPASSABLE):
//push back opposite to movement vector until not colliding
}
>>21084
It is scriptable, in the following example each thing that can collide has a number associated with it ('type' in the latter example), that number is a description of exactly how it collides. You could load those from a config file like the following:
grass
brick_wall_0 IMPASSABLE
brick_wall_1 IMPASSABLE
brick_wall_2 IMPASSABLE
teleport_circle TELEPORT
teleport_wall IMPASSABLE TELEPORT
castle_guard_0 IMPASSABLE ENEMY
teleporting_slime ENEMY TELEPORT //teleports you when you collide with it
//&c
As for scalability you don't need a branch for each thing that can collide, just handle the general cases separate from the specific cases.
The following pseudocode only handles collisions between the player (player) and something else (other). It's easy enough to generalise.
collision_descriptor type = other->collision_desc;
if (type & ENEMY)
other->attack(player);
if (type & IMPASSABLE)
while (colliding(player, other))
player->move(player->movementVector, -1);
if (type & TELEPORT)
player->teleport(other->destination);
>>21087
He probably thinking of handling each specific case separately for some unholy reason. In which case it would be the number of different things that can collide squared. With just a thousand separate things he would need a million branches if he took that approach.
Obviously he ought to handle cases generally.