D
DevilKap
Guest
I have this test NPC, but it wont change its sprite direction.
I think it has to do with the fact that I'm using an image_index based on direction:
How would I format/structure this into a switch statement like the one I have for my player?:
Sorry if this is a silly question, I suck at this but I'm slowly improving (I think).
I just can't wrap my head around how I'm supposed to do this.
I think it has to do with the fact that I'm using an image_index based on direction:
GML:
direction = point_direction(x,y,other.x,other.y);
image_index = CARDINAL_DIR
GML:
//Set Sprite
switch(dir){
case 0: sprite_index = walkRight; break;
case 45: sprite_index = walkUpRight; break;
case 90: sprite_index = walkUp; break;
case 135: sprite_index = walkUpLeft; break;
case 180: sprite_index = walkLeft; break;
case 225: sprite_index = walkDownLeft; break;
case 270: sprite_index = walkDown; break;
case 315: sprite_index = walkDownRight; break;
}
} else {
image_index = 0
}
I just can't wrap my head around how I'm supposed to do this.