The fifth chapter of software engineering iterative development

Source: Internet
Author: User

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, &AMP;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, &AMP;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.