Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i,v in pairs(self) do ---start loop on all assets
- if(type(v) == "table" and v.name ~= nil)then---------loop on those with name
- v.x = GameObjref.x + self.globalOffsetX;
- v.y = GameObjref.y + self.globalOffsetY;
- if(v.Oangle == nil)then v.Oangle = 0; end
- v.angle = v.Oangle + GameObjref.angle
- if(v.Oangle == 0)then
- v.scaleX = GameObjref.scaleX
- v.scaleY = GameObjref.scaleY
- else
- v.scaleY = GameObjref.scaleX
- v.scaleX = GameObjref.scaleY
- end
- ----Animation nation
- if(v.visible == true)then
- for i2,v2 in pairs(self.animation[1][self.animation[2]]["Part"]) do
- local Name = v2["-name"];
- local index = string.find(Name,"$",1,true)
- local found = false
- if(index ~= nil)then
- if(string.sub(Name,0,index-1) == string.sub(v.name,0,index-1))then
- found = true
- end
- end
- if(Name == v.name)then found = true end
- if(found)then ---start found
- local table = self.animation[1][self.animation[2]]["Part"][i2]["Frame"]
- local prevTable = table[self.frame]
- local nextTable = table[(self.frame%(#table))+1]
- if(self.stateTrans)then
- nextTable = table[1]
- table = self.animation[1][self.lastState]["Part"][i2]["Frame"]
- if(self.lastFrame > #table)then self.lastFrame = #table; end
- prevTable = table[self.lastFrame]
- local temp = {};
- temp["-x"] = v.px;
- temp["-y"] = v.py;
- temp["-rotation"] = v.pangle;
- temp["-scaleX"] = v.pscaleX;
- temp["-scaleY"] = v.pscaleY;
- temp["-alpha"] = v.palpha
- temp["-colorMatrix"] = v.pmatrix;
- prevTable = temp;
- factor = (self.stateCount/self.stateCountMax)
- end
- local X = (nextTable["-x"] -prevTable["-x"]) * factor + prevTable["-x"]
- local Y = (nextTable["-y"] -prevTable["-y"]) * factor + prevTable["-y"]
- local SCALEX = (nextTable["-scaleX"] -prevTable["-scaleX"]) * factor + prevTable["-scaleX"]
- local SCALEY = (nextTable["-scaleY"] -prevTable["-scaleY"]) * factor + prevTable["-scaleY"]
- local angDif = nextTable["-rotation"] -prevTable["-rotation"]
- local multFactor = 1;
- if(self == joeref)then
- if(self:getCurrentFrame() == "Run")then
- multFactor = self.animationSpeed
- end
- end
- local ANGLE = (angDif) * factor + (prevTable["-rotation"] * multFactor)
- local ALPHA = (nextTable["-alpha"] -prevTable["-alpha"]) * factor
- XY[1][1] = X; XY[1][2] = Y;
- XY = matrix.mul(XY,rotMatrix);
- local oldX = X;
- local oldY = Y;
- X = XY[1][1];
- Y = XY[1][2];
- v.x = v.x + (X) * self.GameObj.scaleX
- v.y = v.y + (Y) * self.GameObj.scaleY
- v.scaleX = v.scaleX * SCALEX
- v.scaleY = v.scaleY * SCALEY
- if(math.abs(angDif) < 180)then
- v.angle = v.angle + (ANGLE* (math.pi/180)) * (v.scaleX / (math.abs(v.scaleX)))
- else
- angDif = angDif + 360
- ANGLE = (angDif) * factor + prevTable["-rotation"]
- v.angle = v.angle + (ANGLE* (math.pi/180)) * (v.scaleX / (math.abs(v.scaleX)))
- end
- if(self == joeRef)then
- if(self:getCurrentFrame() == "Run")then
- v.angle = v.angle * self.animationSpeed
- end
- end
- v.alpha = prevTable["-alpha"] + ALPHA
- if(prevTable["-colorMatrix"] ~= nil)then
- if(v.colorTransform == nil)then v.colorTransform = {}; v.colorTransform.PixelEffect = shadRef["ColorTransform"] end
- local difTable = {};
- local cPrevTable = prevTable["-colorMatrix"]
- local cNextTable = {};
- if(nextTable["-colorMatrix"] ~= nil)then
- cNextTable = nextTable["-colorMatrix"];
- else
- cNextTable = {1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0};
- end
- -------------------------
- for i=1,20,1 do
- difTable[i] = (cNextTable[i] - cPrevTable[i]) * factor + cPrevTable[i];
- end
- ---------------------------
- v.colorTransform.matrix = difTable;
- end
- if(not self.stateTrans)then
- v.px = (oldX) --* _Joe["Joe"].scaleX;
- v.py = (oldY) --* _Joe["Joe"].scaleY;
- v.pscaleX = SCALEX;
- v.pscaleY = SCALEY;
- v.pangle = ANGLE
- v.palpha = v.alpha
- v.pmatrix = v.colorTransform.matrix;
- end
- end ---end found
- end
- end
- ----------------------End animation nation
- end ---end loop on those with name
- end ---end loop on all assets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement