Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```cpp
- //scan combo next to link based on facing dir:
- int offsets[2]; //x,y
- combodata liftcombo; int facingcombo;
- while(true)
- {
- if (Input->Press[CB_A])
- {
- if ( liftcombo == Null() )
- {
- switch(Link->Dir)
- {
- case DIR_UP: { offsets[0] = 8; offsets[1] = 8; break; }
- case DIR_LEFT: { offsets[0] = 8; offsets[1] = 8; break; }
- case DIR_UPRIGHT{ offsets[0] = 9; offsets[1] = 8; break; }
- case DIR_DOWN: { offsets[0] = 8; offsets[1] = 9; break; }
- default: { offsets[0] = 8; offsets[1] = 8; beak;}
- }
- facingcombo = AdjacentCombo(ComboAt(Link->X+offsets[0], Link->Y+offsets[1]), Link->Dir);
- //compare for lift type
- if ( Screen->ComboT[facingcombo] == CT_LIFT )
- {
- liftcombo = Game->LoadComboData(ld);
- }
- else
- {
- liftcombo = Null();
- }
- }
- else
- {
- //pressing A while holding a combo
- //if we finished the animation
- if ( Link->Misc[LM_LIFT] >= min )
- {
- //throw the object
- Audio->PlaySound(SFX_THROW);
- spritedata throwsd = Game->LoadSpriteData(SPRITE_THROW);
- throwsd->Tile = liftcombo->Tile;
- throwsd->CSet = liftcombo->CSet;
- throwsd->AFrames = liftcombo->AFrames;
- throwsd->ASpeed = liftcombo->ASpeed;
- lweapon toss = Screen->CreateLWeapon(LW_TOSS);
- toss->UseSprite(SPRITE_THROW);
- toss->X = Link->X; //plus dir offsets
- toss->Y = Link->Y; //...
- toss->Dir = Link->Dir;
- //toss jump based on a lw->Misc[] index
- toss->Step = THROW_SPEED;
- liftcombo = Null();
- Link->Action = LA_THROW; //uses custom toss sprite
- }
- }
- }
- //if not pressing A but holding a combo
- if ( liftcombo != Null() )
- {
- Audio->PlaySound(SFX_LIFT);
- ComboD[facingcombo] = 0;
- //do custom sprite animation with
- //for ( Link->Misc[LM_LIFT] = n ... )
- {
- // drawtile(3, liftcombo->Tile, LiftCombo->CSet ... )
- //use Link->Misc[] to store the lift frame
- }
- // if we've reached the end of the lift frames
- if ( Link->Misc[LM_LIFT >= m )
- {
- //until Link throws it, draw the tile over him
- }
- }
- Waitdraw(); Waitframe();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement