Board Thread:Questions and Answers/@comment-1490123-20141003000945

Not exactly sure how to handle all the subroutines and variables and stuff.

This is the structure I came up with. I can think of how to actually execute it, but I don't believe it's the best way to handle it.

Sprite variables-

1. Enemy type

2. Health

3. State

4. X position

5. Y position

6. X Velocity

7. Y Velocity

8. Etc

Steps

Retrieve enemy stats

Obtain enemy gravity

Max Y velocity

Max X velocity

Retrieve enemy behavior

Check current situation (Position, touching wall, pursuing player, etc.)

Act Depending on situation.

-Move left/right

-Turn around

-Idle

-Pursue

-sAttack

Write Enemy position variables.

Wall detection

IF enemy is touching a wall- Set position

- If not pursuing player Turn around

- If pursuing, Jump.

IF enemy detects Edge

- If not pursuing player - Turn around

- If pursing player, keep pursuing.

If certain conditions are met, write extra instruction for next time enemy loop is done -or- if it proves to be more effeciant to do so, run enemy's loop again.  