Code:
void onLevelLoad(){
jjObjectPresets[OBJECT::BOLLPLATFORM].behavior = IceballPlatform;
}
void IceballPlatform(jjOBJ@ plat) {
int angle = 0;
//get part of the angle before it moves
if (plat.state == STATE::PUSH)
angle = plat.var[4];
else if (plat.state == STATE::ACTION || plat.state == STATE::FREEZE)
if (plat.var[3] == 1) //U swing
angle = 1024 + int(jjSin(plat.var[4])*65536)/256;
else
angle = plat.var[4];
plat.behave(BEHAVIOR::PLATFORM, false);
angle += plat.var[5] * plat.var[2];
//links
int radius = 0;
jjObjects[0].curAnim = plat.killAnim;
jjObjects[0].frameID = 0;
int frame = jjObjects[0].determineCurFrame(false);
int radadd = 11; //one less than the width of the sprite, so change this if dealing with other platforms
int angleadd = -plat.var[5];
SPRITE::Mode mode = (plat.freeze != 0) ? SPRITE::FROZEN : SPRITE::TINTED;
for (int n=0; n< plat.var[2]; ++n) {
jjDrawSpriteFromCurFrame(
plat.xOrg + radius * jjSin(angle),
plat.yOrg + radius * jjCos(angle),
frame, 0,
mode, 151
);
angle+=angleadd;
radius+=radadd;
}
//ball
jjDrawSpriteFromCurFrame(plat.xPos, plat.yPos, plat.curFrame, plat.direction, SPRITE::TINTED, 151);
}
__________________
|