[object moving_ C language version] [continuous update]

Time:2020-10-22

 

#include "stdio.h"
 #include "time.h"
 #include 
 
 //===================================================
 //
 //Title: C language to achieve villain mobile v1.0
 //Author: Zou Yang
 //  Date : 2020/05/28
 //June 4, 2020 1. The problem of walking map restriction is improved, and the optimization algorithm is p_ X±P_ When the speed is greater than or less than the map boundary, the location is set to the map boundary to prevent the villains from crossing the boundary. 
 //2. Added the function of holding a gun (not useful at present...) 
 //
 //===================================================
 
 void main(){
     typedef enum{false, true}bool;
           
     int i,j;
 
     int P_ X = 2; // body position X coordinate
     int P_ Y = 7; // body position Y coordinate, based on foot
     Int height = 12; // height
     Int weight = 12; // width
     int P_ Speed = 4; // movement speed
     Char warning [10] =; // warning content
 
     char people_ Head ='0 '; // arm
     char people_ Arm ='l '; // arm
     char people_ Leg ='x '; // leg
     
     Char bullet = '-'; // Bullet
     bool b_ Sign = false; // judge to shoot 
     
     Char graph [height] [weight]; // map array
 
     while(1){
     for(i=0;i11){
             P_X=11;
             Strcpy (warning, "can't move! "";    
         }
         else{
             P_X+=P_SPEED;
             strcpy(WARNING," ");
             }
         }
     If (GetAsyncKeyState ('z ')) {// fire the bullet  
         b_sign = !b_sign;
     }
 
     graph[P_ Y-2][P_ X] = people_ Head; // placed by
     graph[P_Y-1][P_X] = people_arm;
     graph[P_Y][P_X] = people_leg;
     if(b_sign==true)
         graph[P_Y-1][P_X+1] = bullet;
     
     for(i=0;i

 

Display effect:

 

 

Update effect:

 

Recommended Today

Can’t you tell a pile from a fool? This article tells you the best way to open heap in Java collection

In the “Java collection framework” in the last article, there is still one big problem that has not been mentioned, that is, priority queue, heap. What is heap? Heap is actually a special kind of queue priority queue. The ordinary queue game rule is very simple: first in first out; but this kind of priority […]