can someone help me find out my swords flip and tile offsets?
I have two functions for it but I link's directions are very different from the sword's
here is my code
Spoiler
//tile flip //0 = no flip //1 = horizontal flip //2 = vertical flip //3 = both (180 degree rotation) //tile offsets //0 = sword tile up //1 = sword tile left //2 = sword tile up (flash) //3 = sword tile left (flash) //4 = unused //5 = sword tile up (slash) //6 = sword tile down (slash) //7 = sword tile left (slash) //8 = sword tile right (slash) //linkdir: //0 = up //1 = down //2 = left //3 = right //sworddir //0 = up //1 = up left //2 = left //3 = left down //4 = down //5 = down right //6 = right //7 = right up //maxsworddir // the maxiumum loop times //UpdateSwing360() // arg0 = the sword lweapon // arg1 = the animation speed // arg2 = a array of x positions // arg3 = a array of y positions // arg4 = a array of x hitbox positions // arg5 = a array of y hitbox positions // arg6 = a array of hitbox widths // arg7 = a array of hitbox heights void UpdateSwing360(int type, int framespeed, int x, int y, int hitx, int hity, int hitw, int hith) { lweapon sword = CreateLWeapon(type); int startTile = SWORD_TILE; int spaceTile = SWORD_SPACE; int flip; int offset; sword->CollDetection = true; for(int i=0; i<8; i++) { sword->ASpeed = 0; sword->X = Link->X + x[i]; sword->Y = Link->Y + y[i]; sword->HitXOffset = hitx[i]; sword->HitYOffset = hity[i]; sword->HitWidth = hitw[i]; sword->HitHeight = hith[i]; flip = FindFlip(Link->Dir, i, 8); offset = FindOffset(Link->Dir, i, 8); sword->Tile = SWORD_TILE + offset; sword->Flip = flip; } } void FindOffset(int linkdir, int sworddir, int maxsworddir) { int offset; int dir = (sworddir + (maxsworddir * 2)) mod maxsworddir; if (dir == 0) { offset = 0; } //Up else if (dir == 1) { offset = 5; } //Up Left else if (dir == 2) { offset = 1; } //Left else if (dir == 3) { offset = 6; } //Left Down else if (dir == 4) { offset = 0; } //Down else if (dir == 5) { offset = 7; } //Down Right else if (dir == 6) { offset = 1; } //Right else if (dir == 7) { offset = 8; } //Right Up return offset; } void FindFlip(int linkdir, int sworddir, int maxsworddir) { int flip; int dir = (sworddir + (maxsworddir * 2)) mod maxsworddir; if (dir == 0) { flip = 0; } //Up else if (dir == 1) { flip = 0; } //Up Left else if (dir == 2) { flip = 0; } //Left else if (dir == 3) { flip = 3; } //Left Down else if (dir == 4) { flip = 0; } //Down else if (dir == 5) { flip = 0; } //Down Right else if (dir == 6) { flip = 1; } //Right else if (dir == 7) { flip = 0; } //Right Up return flip; }
this is a example of the way I want the tiles to be set up