Hey, I was wondering how did you make it so that when you hit the angled boxes they rotate?
Viewing post in 16x16 Industrial Tileset comments
Hi there! I've send you and email but just so this doesn't hung unanswered:
It's basically matter of keeping rotation value for drawing and target rotation separate values.
so something like this (pseudocode):
update: rDraw = rDraw + (rTarget - r) / 2 triggerRotate: rTarget = rTarget + 1 // 1 instead of PI/2 directly so getDirection is simpler draw: draw(image, x, y, rDraw * PI/2) getDirectionOfTheBulletAfterItIsReflected: let t = fmod(floor(rTarget), 4) if (t==0 and fromX==1) or (t==0 and fromY==-1) or (t==2 and fromY==1) or (t==2 and fromX==-1) then return -fromY, -fromX else if (t==1 and fromY==1) or (t==1 and fromX==1) or (t==3 and fromY==-1) or (t==3 and fromX==-1) then return fromY, fromX else return 0, 0