Skip to content

hero: refactor movement code for efficiency #89

@jorgegv

Description

@jorgegv

The current movement code consists of several code paths, which are very similar and only differ in that the checks are done for a few variables, and they act on only a couple of them.

They can probably be refactored in some generic code which can be used to do checks from a table and act on the coordinates according to that table.

This would make easy also to enable explicit 8-direction movement (i.e. diagonal and straight) and reduce the amount of code.

Also, this would make conditional compile for either 4- or 8-direction movement trivial (i.e. a table with just 4 or 8 checks)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions