//start move from A (curr pos) to B (to end) then stop or reverse etc. //Pass SM_NONE to x or y to start from the current position, //even before it has finished moving void Sprite::startMoveTo(int xEnd, int yEnd, Uint32 rate, Uint32 delay, float xVel, float yVel, eSprite type /*Sprite::SPR_NONE*/) //repeat, reverse etc { //direction //set by end x or y, or overridden by SM_ direction flags if ( (SPR_LEFT & type) || (xEnd < getXPos()) ) _xDir = -1; else _xDir = 1; //pos=right, neg=left if ( (SPR_UP & type) || (yEnd < getYPos()) ) _yDir = -1; else _yDir = 1; //pos=down, neg=up //end position //if SM_ direction flags used (ie. no end pos), then determine off //screen end positions from sprite size, ie. sprite must be completely //off screen then stop (or reverse if that flag is set _xEnd = xEnd; _yEnd = yEnd; if (SPR_LEFT & type) _xEnd = -(tileW()+1); //calc end x pos (off screen) if (SPR_RIGHT & type) _xEnd = Screen::width() + 1; //calc end x pos (off screen) if (SPR_UP & type) _yEnd = -(tileH()+1); //calc end x pos (off screen) if (SPR_DOWN & type) _yEnd = Screen::height()+1; //calc end x pos (off screen) //velocity _xVel = xVel; _yVel = yVel; //attributes //##TODO## effects flags stuff here // calcWaypoints(_x, _y, xEnd, yEnd); //unpause movement if movement is set up correctly pauseMove( !canMove() ); //set false, if moving set setMoveLoop(true); //repeat any timer/movement //finally start the timer if requested if (rate && canMove()) setMoveRate(rate, delay); }
int ioptronHC8406::setioptronHC8406CursorMoveSpeed(int type) { return setMoveRate(-1,type); }
int ioptronHC8406::setioptronHC8406SlewRate(int rate) { return setMoveRate(rate,USE_SLEW_SPEED); }
int ioptronHC8406::setioptronHC8406CenterRate(int rate) { return setMoveRate(rate,USE_CENTERING_SPEED); }
int ioptronHC8406::setioptronHC8406GuideRate(int rate) { return setMoveRate(rate,USE_GUIDE_SPEED); }