@@ -44,29 +44,28 @@ export class hitbox{
44
44
setCoords = ( ) => {
45
45
let coords = this . hitboxData . coords ;
46
46
let hoffset = this . hitboxData . offset ;
47
- let foffset = this . frameData . offset ;
48
47
49
- coords . left = hoffset . x + foffset . x - ( this . hitboxData . width / 2 ) ;
50
- coords . top = hoffset . y + foffset . y - ( this . hitboxData . height / 2 ) ;
51
- coords . right = hoffset . x + foffset . x + ( this . hitboxData . width / 2 ) ;
52
- coords . bottom = hoffset . y + foffset . y + ( this . hitboxData . height / 2 ) ;
48
+ coords . left = hoffset . x - ( this . hitboxData . width / 2 ) ;
49
+ coords . top = hoffset . y - ( this . hitboxData . height / 2 ) ;
50
+ coords . right = hoffset . x + ( this . hitboxData . width / 2 ) ;
51
+ coords . bottom = hoffset . y + ( this . hitboxData . height / 2 ) ;
53
52
}
54
53
55
54
//#region getter
56
55
getLeft = ( scale = 1 , pan = 0 ) => {
57
- return this . hitboxData . coords . left * scale + pan ;
56
+ return ( this . hitboxData . coords . left + this . frameData . offset . x ) * scale + pan ;
58
57
}
59
58
60
59
getTop = ( scale = 1 , pan = 0 ) => {
61
- return this . hitboxData . coords . top * scale + pan ;
60
+ return ( this . hitboxData . coords . top + this . frameData . offset . y ) * scale + pan ;
62
61
}
63
62
64
63
getRight = ( scale = 1 , pan = 0 ) => {
65
- return this . hitboxData . coords . right * scale + pan ;
64
+ return ( this . hitboxData . coords . right + this . frameData . offset . x ) * scale + pan ;
66
65
}
67
66
68
67
getBottom = ( scale = 1 , pan = 0 ) => {
69
- return this . hitboxData . coords . bottom * scale + pan ;
68
+ return ( this . hitboxData . coords . bottom + this . frameData . offset . y ) * scale + pan ;
70
69
}
71
70
//#endregion
72
71
0 commit comments