Today, we are working with team members to develop skills, but they are not yet productive, so there is less content.
Modified a small bug, about the new account born character experience wrong.
This is the character initialization function (constructor), Exp represents the experience, first written in Exp=maxexp, so experience is problematic.
Player::P layer (): TJ (1.6,0.240.020.0) { 1.6; 0.2 ; 0 ; SETLV (1); = maxhp; 0 ; 0.01 ;}
I also modified the mob's mobile AI. Previously a monster would have moved to coincide with the player, and now it has changed into an attack range and stopped.
As follows:
Entire MOVAAI:
voidMonster::moveai () {Doubledx, dy; intpid; intmoveto=5; if(Getnearplayer (&pid, &DX, &dy) >Findenemyrange) { if(Movefx = =0) {//stand in the same placeMoveTo = Random (4); MOVEF=0; } Else{//before the move if(Movef <=2) {//The number of steps in the direction of movement is less than 3 steps, continue in this directionmovef++; if(Movefx = =4) MoveTo=1; Else if(Movefx = =2) MoveTo=0; Else if(Movefx = =1) MoveTo=2; Else if(Movefx = =3) MoveTo=3; ElseMoveTo=4; } Else{//otherwise randomMOVEF =0; MoveTo= Random ( the);//Temporary storage if(MoveTo <=6) {//1/2 chance to move on in that direction if(Movefx = =4) MoveTo=1; Else if(Movefx = =2) MoveTo=0; Else if(Movefx = =1) MoveTo=2; Else if(Movefx = =3) MoveTo=3; ElseMoveTo=4; } Else{//1/2 chance to move or stop in a random directionMoveTo = Random (6); } } } Switch(moveto) { Case 0: MoveDown (movespeed); Movefx=2; Break; Case 1: MoveUp (movespeed); Movefx=4; Break; Case 2: MoveLeft (movespeed); Movefx=1; Break; Case 3: MoveRight (movespeed); Movefx=3; Break; default: Movefx=0; sprintf (Buffer,"MG%d%d%d%lf%lf%lf", Curmap->id, ID,0, WX, WY, HP); Gengxinmonster (buffer); Break; } } Else if(Getnearplayer (&pid, &DX, &dy) <0.06) { } Else { if(ABS (DX) >=abs (DY)) { if(DX <-movespeed) { if(MoveLeft (Movespeed)) {}Else { if(Dy <-movespeed) { if(MoveDown (Movespeed)) {}}Else if(Dy >movespeed) { if(MoveUp (Movespeed)) {}}} } Else if(DX >movespeed) { if(MoveRight (Movespeed)) {}Else { if(Dy <-movespeed) { if(MoveDown (Movespeed)) {}}Else if(Dy >movespeed) { if(MoveUp (Movespeed)) {}}} } } Else{ if(Dy <-movespeed) { if(MoveDown (Movespeed)) {}Else { if(DX <-movespeed) { if(MoveLeft (Movespeed)) {}}Else if(DX >movespeed) { if(MoveRight (Movespeed)) {}}} } Else if(Dy >movespeed) { if(MoveUp (Movespeed)) {}Else { if(DX <-movespeed) { if(MoveLeft (Movespeed)) {}}Else if(DX >movespeed) { if(MoveRight (Movespeed)) {}}} } } }}
Add the following paragraph to the entire MOVEAI, as long as the distance is close enough to do nothing.
Else if 0.06 ) { }
The fifth chapter of software engineering iterative development