Quote:
Originally Posted by minmay
Anyone have the code (or just a mathematical description) for pickups bobbing up and down?
|
Code:
int frame = obj.objectID * 8 + jjGameTicks;
if (obj.yPos > jjWaterLevel) frame = frame*2 + (int(obj.xPos) + int(obj.yPos) * 256)*16;
else frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;
if (obj.ySpeed == 0) jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction);
else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction);
|