remoteMap animated belts (yellows are bugged)

This commit is contained in:
Danielv123 committed 2018-03-03 21:58:31 +01:00
1 parent 0b07698b78
commit dc62e714d6
4 files changed
+102 -34

No files matched your search

+10 -1
View File
@@ -9,11 +9,20 @@ export function getParameterByName(name, url) {
}
// ctx, entityImages[name].img, xPos, yPos, size.x, size.y, rotation, sprWidth, sprHeight, offLeft, offTop
export function drawImageWithRotation(ctx, image, x, y, w, h, degrees, sprWidth, sprHeight, offLeft, offTop){
export function drawImageWithRotation(ctx, image, x, y, w, h, degrees, sprWidth, sprHeight, offLeft, offTop, flipX, flipY){
ctx.save();
ctx.translate(x+w/2, y+h/2);
ctx.rotate(degrees*Math.PI/180.0);
ctx.translate(-x-w/2, -y-h/2);
if(flipX) {
x -= x*2+sprWidth;
ctx.scale(-1, 1);
}
if(flipY){
y -= y*2+sprHeight;
ctx.scale(1, -1);
}
if(sprWidth != undefined && sprHeight != undefined && offLeft != undefined && offTop != undefined){
// console.log(sprWidth+" "+sprHeight+" "+offLeft+" "+offTop+" "+w+" "+h)
ctx.drawImage(image, offLeft, offTop, sprWidth, sprHeight, x, y, w, h);