View Single Post
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,812

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Oct 31, 2013, 12:53 AM
cooba is offline
Reply With Quote
Quote:
Originally Posted by minmay View Post
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);