• entries
    34
  • comments
    51
  • views
    41056

Monsters!

Sign in to follow this  
r1ckparker

497 views

It was surprisingly easy to get the monsters in and animated, and facing the correct direction in relation to the player. Basically the player has one of 4 directions (0, 1, 2 and 3) and the monster has 1 of 4 directions (0, 1, 2 and 3) and you subtract the monsters direction from the players direction to give you which sprite to plot. If the result is less than 0 you add 4.

E.g. if player is facing East (1) and enemy facing South (2)

1-2 = -1
-1+4 = 3

Plot monster sprite 3. Repeat!

Sign in to follow this  


5 Comments


Recommended Comments

Sorry I mixed up the two parameters, I meant (Md - Pd) % 4 which will give you the same results as adding +4 to negative numbers and leave the positive ones unchanged.

[s]Player Monster Pd-Md%4 0 0 0 0 1 3 0 2 2 0 3 1 1 0 1 1 1 0 1 2 3 1 3 2 2 0 2 2 1 1 2 2 0 2 3 3 3 0 3 3 1 2 3 2 1 3 3 0[/s]

Looks like the editor doesn't like me pasting from excel, but the math is good (or am I really that tired? :P)[s]
[/s]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now