Looks really good, but there's a lot of code going on in the collisions and movement I would try to avoid. I'm not a huge fan of long code
On the bod actor->draw I would have:
- Code: Select all
char *key=GetKeyState();
x += 2*(key[KEY_RIGHT]-key[KEY_LEFT]);
y += 2*(key[KEY_DOWN]-key[KEY_UP]);
Then collision->anyside->repeat since were using x/y + instead of velocity, just this will do.
- Code: Select all
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);
Then I'd get rid of all the stop animations the player has, since they are just the fourth frame of the walking animations and use this for the draw actor:
- Code: Select all
char *key=GetKeyState();
int dir = (3*key[KEY_UP]+5*key[KEY_LEFT]+7*key[KEY_DOWN]+9*key[KEY_RIGHT]);
if(dir)
ChangeAnimationDirection("Event Actor", FORWARD);
switch(dir)
{
case 0: case 10: case 14:
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 4;
break;
case 3:ChangeAnimation("Event Actor", "Up", NO_CHANGE);
break;
case 5:ChangeAnimation("Event Actor", "Left", NO_CHANGE);
break;
case 7:ChangeAnimation("Event Actor", "Down", NO_CHANGE);
break;
case 9:ChangeAnimation("Event Actor", "Right", NO_CHANGE);
break;
}
Again, that's just me hating long codes. It doesn't work EXACTLY like how you had it before (in the since of holding keys it will go diagonal, easy fix if it bugs you a lot. And when the player runs into a wall he doesn't stop animating, also easy fix if it bugs you.) But I was just showing you my way since, well I'm not sure. I just like blabbing I guess!
EDIT: That post seems a bit snooty, don't change your code because of me
I was just being an example