当前位置:
西门子1200贪吃蛇程序带触摸屏可仿真
回复 | 人气 | 打印
zeyao00 个人主页 给TA发消息 加TA为好友 发表于:2019-11-19 14:57:43 楼主

西门子1200贪吃蛇 程序带触摸屏 可仿真 SCL 博图V14

正在下载,请等待……
下载附件需3积分!

分享到: 关注收藏 邀请回答 回复 举报

Lonely_99 个人主页 给TA发消息 加TA为好友 发表于:2019-11-19 15:05:15 1楼
 

谢谢楼主分享,已果断下载

  回复 引用 举报
郭远林 个人主页 给TA发消息 加TA为好友 发表于:2019-11-19 15:19:16 2楼
 

这个不错,我晚上测试一下,刚刚的,我看看能不能教我侠门玩玩

  回复 引用 举报
AC米兰 个人主页 给TA发消息 加TA为好友 发表于:2019-11-21 10:18:29 3楼
 

回复内容:

对: 郭远林 这个不错,我晚上测试一下,刚刚的,我看看能不能教我侠门玩玩 内容的回复!

-------------------------


  回复 引用 举报
AC米兰 个人主页 给TA发消息 加TA为好友 发表于:2019-11-21 10:19:42 4楼
 

下载下来看看

  回复 引用 举报
ju691031 个人主页 给TA发消息 加TA为好友 发表于:2019-11-21 20:22:10 5楼
 

下载下来看看

  回复 引用 举报
IE5338 个人主页 给TA发消息 加TA为好友 发表于:2019-11-22 12:06:37 6楼
 


估计现在这程序都没人自己重新编程,都是复制粘贴过来的



macro_command main()
bool Line_one[16],Line_two[16],Line_three[16],Line_four[16],Line_five[16],Line_six[16]
bool Line_seven[16],Line_eight[16],Line_nine[16],Line_ten[16],Line_eleven[16],Line_twelve[16]
bool Line_thirteen[16],Line_fourteen[16],Line_fifteen[16],Line_sixteen[16],Line_seventeen[16]
bool Line_eighteen[16],Line_nineteen[16],Line_twenty[16]
bool Line_matrix[320],display_matrix[320],snake_matrix[320]
bool new_game,start_flag,pause_flag,new_game_button,run_game
bool true_bool = true,false_bool = false
bool up_control,down_control,left_control,right_control
bool up_flag,down_flag,left_flag,right_flag
bool game_over=false,eat_flag
short start_rand,start_pos,next_rand,next_point,snake_point[320],snake_length,index,snake_last_point[320]
short speed,score,best_score,flash_index,search_snake
short snake_end,pre_direction
float start_point,start_float
short snake_first,snake_last
GetData(new_game, "Local HMI", LB, 2, 1)
GetData(start_flag, "Local HMI", LB, 0, 1)
GetData(pause_flag, "Local HMI", LB, 1, 1)
GetData(up_control, "Local HMI", LB, 3, 1)
GetData(right_control, "Local HMI", LB, 4, 1)
GetData(down_control, "Local HMI", LB, 5, 1)
GetData(left_control, "Local HMI", LB, 6, 1)
GetData(speed, "Local HMI", RW, 28, 1)
GetData(best_score, "Local HMI", RW, 21, 1)
//GetData(Line_one[0], "Local HMI", RW_Bit, 0.0, 16)
//GetData(Line_two[0], "Local HMI", RW_Bit, 1.0, 16)
//GetData(Line_three[0], "Local HMI", RW_Bit, 2.0, 16)
//GetData(Line_four[0], "Local HMI", RW_Bit, 3.0, 16)
//GetData(Line_five[0], "Local HMI", RW_Bit, 4.0, 16)
//GetData(Line_six[0], "Local HMI", RW_Bit, 5.0, 16)
//GetData(Line_seven[0], "Local HMI", RW_Bit, 6.0, 16)
//GetData(Line_eight[0], "Local HMI", RW_Bit, 7.0, 16)
//GetData(Line_nine[0], "Local HMI", RW_Bit, 8.0, 16)
//GetData(Line_ten[0], "Local HMI", RW_Bit, 9.0, 16)
//GetData(Line_eleven[0], "Local HMI", RW_Bit, 10.0, 16)
//GetData(Line_twelve[0], "Local HMI", RW_Bit, 11.0, 16)
//GetData(Line_thirteen[0], "Local HMI", RW_Bit, 12.0, 16)
//GetData(Line_fourteen[0], "Local HMI", RW_Bit, 13.0, 16)
//GetData(Line_fifteen[0], "Local HMI", RW_Bit, 14.0, 16)
//GetData(Line_sixteen[0], "Local HMI", RW_Bit, 15.0, 16)
//GetData(Line_seventeen[0], "Local HMI", RW_Bit, 16.0, 16)
//GetData(Line_eighteen[0], "Local HMI", RW_Bit, 17.0, 16)
//GetData(Line_nineteen[0], "Local HMI", RW_Bit, 18.0, 16)
//GetData(Line_twenty[0], "Local HMI", RW_Bit, 19.0, 16)
GetData(Line_matrix[0], "Local HMI", RW_Bit, 0.0, 320)
if new_game and not game_over then
 game_over = false
 score = 0
 snake_length = 1
 eat_flag = false
 SetData(false_bool, "Local HMI", LB, 100, 1)
 FILL(Line_matrix[0], 0, 320)
 FILL(display_matrix[0], 0, 320)
 FILL(snake_matrix[0],0,320)
 FILL(snake_last_point[0],0,320)
 FILL(snake_point[0],0,320)
 SetData(Line_matrix[0], "Local HMI", RW_Bit, 0.0, 320) 
 SetData(display_matrix[0], "Local HMI", RW_Bit, 30.0, 320) 
 new_game_button = true
 run_game = true
 new_game = false
 down_flag = true
 pre_direction = 2 
 
end if
if new_game_button and not new_game then  
 RAND(start_rand)
 start_pos = start_rand/100 
 if start_pos>=320 then
  start_pos = 319
 end if
 snake_first = start_pos
 RAND(next_rand)
 next_point = next_rand/100
 if next_point>=320 then
  next_point = 319
 end if
 snake_point[start_pos] = 1
 Line_matrix[start_pos] = true
 display_matrix[start_pos] = true
 display_matrix[next_point] = true
 SetData(Line_matrix[0], "Local HMI", RW_Bit, 0.0, 320) 
 SetData(display_matrix[0], "Local HMI", RW_Bit, 30.0, 320) 
 new_game_button = false
 DELAY(50)
end if
if start_flag then
 run_game = true
end if
if pause_flag then
 run_game = false
end if
if up_control and pre_direction<>2 then
 up_flag = up_control
 down_flag = false
 left_flag = false
 right_flag = false
 pre_direction = 1
 TRACE("pre_direction=%d",pre_direction)
else if down_control and pre_direction<>1 then
 down_flag = down_control
 up_flag = false
 left_flag = false
 right_flag = false
 pre_direction = 2
 TRACE("pre_direction=%d",pre_direction)
else if left_control and pre_direction<>4 then
 left_flag = left_control
 up_flag = false
 down_flag = false
 right_flag = false
 pre_direction = 3
 TRACE("pre_direction=%d",pre_direction)
else if right_control and pre_direction<>3 then
 right_flag = right_control
 up_flag = false
 down_flag = false
 left_flag = false
 pre_direction = 4
 TRACE("pre_direction=%d",pre_direction)
end if
if run_game then 
 if up_flag then
  Line_matrix[start_pos] = false
  display_matrix[start_pos] = false
  if start_pos>15 then
   if not eat_flag then
    snake_end = start_pos
    if snake_length>=2 then
     for flash_index = 0 to 319 step 1
      snake_point[flash_index] = snake_last_point[flash_index]
     next flash_index
    end if
    start_pos = start_pos - 16
    snake_point[start_pos] = 1
    snake_point[snake_end] = 0
    TRACE("snake_length=%d",snake_length)
   else if eat_flag and snake_length == 1 then
    snake_end = start_pos
    eat_flag = false
    snake_last_point[snake_end] = 1
    start_pos = start_pos - 16
    snake_first = start_pos
    snake_point[snake_end] = snake_last_point[snake_end]
    snake_point[start_pos] = 1
    snake_last = snake_end
    snake_length = snake_length + 1 
    TRACE("snake_end=%d",snake_end)
    TRACE("start_pos=%d",start_pos)
    TRACE("snake_length=%d",snake_length)
   else if eat_flag and snake_length <> 1 then
    for flash_index = 0 to 319 step 1
     snake_point[flash_index] = snake_last_point[flash_index]
    next flash_index
    start_pos = start_pos - 16
    snake_first = start_pos 
    snake_point[start_pos] = 1
    eat_flag = false
    snake_length = snake_length + 1
    TRACE("snake_end=%d",snake_end)
    TRACE("start_pos=%d",start_pos)
    TRACE("snake_length=%d",snake_length)    
   end if      
  else if start_pos<=15 then
   game_over = true 
  end if
  for search_snake = 0 to 319 step 1
   if snake_point[search_snake] == 1 then
    Line_matrix[search_snake] = true
    display_matrix[search_snake] = true 
    TRACE("snake_point[search_snake]=%d",snake_point[search_snake])
    TRACE("search_snake=%d",search_snake)
   end if
  next search_snake
  
  //for flash_index = 0 to 319 step 1
  // snake_last_point[flash_index] = snake_point[flash_index]
  //next flash_index
 else if down_flag then
  Line_matrix[start_pos] = false
  display_matrix[start_pos] = false
  if start_pos<=303 then
   start_pos = start_pos + 16
  else if start_pos>303 then
   game_over = true
  end if
  Line_matrix[start_pos] = true
  display_matrix[start_pos] = true
  //for flash_index = 0 to 319 step 1
  // snake_last_point[flash_index] = snake_point[flash_index]
  //next flash_index
 else if left_flag then
  Line_matrix[start_pos] = false
  display_matrix[start_pos] = false
  if start_pos<>0 and start_pos<>16 and start_pos<>32 and start_pos<>48 and start_pos<>64 and start_pos<>80 and start_pos<>96 and start_pos<>112 and start_pos<>128 and start_pos<>144 and start_pos<>160 and start_pos<>176 and start_pos<>192 and start_pos<>208 and start_pos<>224 and start_pos<>240 and start_pos<>256 and start_pos<>272 and start_pos<>288 and start_pos<>304 then
   start_pos = start_pos - 1
  else if start_pos==0 or start_pos==16 or start_pos==32 or start_pos==48 or start_pos==64 or start_pos==80 or start_pos==96 or start_pos==112 or start_pos==128 or start_pos==144 or start_pos==160 or start_pos==176 or start_pos==192 or start_pos==208 or start_pos==224 or start_pos==240 or start_pos==256 or start_pos==272 or start_pos==288 or start_pos==304 then
   game_over = true  
  end if
  Line_matrix[start_pos] = true
  display_matrix[start_pos] = true
  //for flash_index = 0 to 319 step 1
  // snake_last_point[flash_index] = snake_point[flash_index]
  //next flash_index
 else if right_flag then
  Line_matrix[start_pos] = false
  display_matrix[start_pos] = false
  if start_pos<>15 and start_pos<>31 and start_pos<>47 and start_pos<>63 and start_pos<>79 and start_pos<>95 and start_pos<>111 and start_pos<>127 and start_pos<>143 and start_pos<>159 and start_pos<>175 and start_pos<>191 and start_pos<>207 and start_pos<>223 and start_pos<>239 and start_pos<>255 and start_pos<>271 and start_pos<>287 and start_pos<>303 and start_pos<>319 then
   start_pos = start_pos + 1
  else if start_pos==15 or start_pos==31 or start_pos==47 or start_pos==63 or start_pos==79 or start_pos==95 or start_pos==111 or start_pos==127 or start_pos==143 or start_pos==159 or start_pos==175 or start_pos==191 or start_pos==207 or start_pos==223 or start_pos==239 or start_pos==255 or start_pos==271 or start_pos==287 or start_pos==303 or start_pos==319 then
   game_over = true
  end if
  Line_matrix[start_pos] = true
  display_matrix[start_pos] = true
  //for flash_index = 0 to 319 step 1
  // snake_last_point[flash_index] = snake_point[flash_index]
  //next flash_index
 end if
 if next_point == start_pos then
  RAND(next_rand)
  next_point = next_rand/100
  if next_point>=320 then
   next_point = 318
  end if
  display_matrix[next_point] = true
  SetData(display_matrix[0], "Local HMI", RW_Bit, 30.0, 320)
  score = score + 1
  SetData(score, "Local HMI", RW, 20, 1)
  eat_flag = true
 end if
 if score>best_score then
  best_score = score
  SetData(score, "Local HMI", RW, 21, 1)
 end if
 SetData(Line_matrix[0], "Local HMI", RW_Bit, 0.0, 320) 
 SetData(display_matrix[0], "Local HMI", RW_Bit, 30.0, 320) 
 //DELAY(speed)
end if
if game_over then
 run_game = false
 SetData(true_bool, "Local HMI", LB, 100, 1)
end if
end macro_command


  回复 引用 举报
IE5338 个人主页 给TA发消息 加TA为好友 发表于:2019-11-22 12:07:10 7楼
 

sub short RAND_num(short para)
RAND(para)
return para
end sub
macro_command main()
bool button_flag[3],game_run,game_over,game_pause,game_init,eat_flag,bool_true = true,bool_false = false
bool display_snake[320],display_init[320]
short direction,pro_direction,get_dir,init_dir = 1
short snake_head_p,snake_cell_p,snake_body_p[318]
short snake_martix[320],snake_pre_martix[320]
short score,best_score,snake_length,speed
short start_rand,next_rand,next_point
short init_index,display_index,count_index,length_index
short temp_body,temp_next_body,temp_last_body
GetData(get_dir, "Local HMI", LW, 0, 1)
GetData(button_flag[0], "Local HMI", LB, 0, 3)
GetData(speed, "Local HMI", RW, 28, 1)
if get_dir==1 and pro_direction<>2 then
 direction = 1
 pro_direction = 1
else if get_dir==2 and pro_direction<>1 then
 direction = 2
 pro_direction = 2
else if get_dir==3 and pro_direction<>4 then
 direction = 3
 pro_direction = 3
else if get_dir==4 and pro_direction<>3 then
 direction = 4
 pro_direction = 4
end if
if button_flag[2] then
 score = 0
 SetData(score, "Local HMI", RW, 20, 1)
 snake_length = 3
 SetData(bool_false, "Local HMI", LB, 100, 1)
 FILL(display_snake[0],0,320)
 FILL(display_init[0],0,320)
 FILL(snake_martix[0],0,320)
 FILL(snake_pre_martix[0],0,320)
 eat_flag = false
 game_over = false
 game_pause = false  
 game_init = true
end if
if game_init and not button_flag[2] then
 RAND(start_rand)
 if start_rand >= 32000 then
  RAND(start_rand)
 end if
 snake_head_p = start_rand/100
 if snake_head_p%16 > 2 then
  snake_body_p[0] = snake_head_p - 1
  snake_cell_p = snake_head_p - 2
  init_dir = 4
  SetData(init_dir, "Local HMI", LW, 0, 1)
  direction = 4
  pro_direction = 4
 else if snake_head_p%16 <= 2 then
  snake_body_p[0] = snake_head_p + 1
  snake_cell_p = snake_head_p + 2
  init_dir = 3
  SetData(init_dir, "Local HMI", LW, 0, 1)
  direction = 3
  pro_direction = 3
 end if
 RAND(next_rand)
 next_point = next_rand/100
 if next_point >= 320 or next_point == snake_head_p or next_point == snake_body_p[0] or next_point == snake_cell_p then
  RAND(next_rand)
 end if
 next_point = next_rand/100
 display_init[next_point] = true
 for init_index = 0 to 319 step 1
  if init_index == snake_head_p or init_index == snake_body_p[0] or init_index == snake_cell_p then
   snake_martix[init_index] = 1
   display_snake[init_index] = true
   display_init[init_index] = true
   SetData(display_snake[0], "Local HMI", RW_Bit, 0.0, 320)
   SetData(display_init[0], "Local HMI", RW_Bit, 30.0, 320)
  end if
  snake_pre_martix[init_index] = snake_martix[init_index]
 next init_index
 game_run = true
 game_init = false
 DELAY(80) 
end if
if game_run then
 if direction == 1 then
  if snake_head_p > 15 then
   if not eat_flag then
    snake_pre_martix[snake_cell_p] = 0
    snake_cell_p = snake_body_p[0]
    if snake_length>3 then
     for length_index = 0 to snake_length-4 step 1
      //temp_last_body = length_index + 4
      temp_next_body = length_index + 1
      snake_body_p[length_index] = snake_body_p[temp_next_body]
      //if temp_next_body == 1 then
      // break
      //end if
     next length_index
    end if
    temp_body = snake_length-3
    snake_body_p[temp_body] = snake_head_p
    snake_head_p = snake_head_p - 16
   else if eat_flag then
    for length_index = 3 to 318 step 1
     if length_index == snake_length then
      temp_body = snake_length-3
      snake_body_p[temp_body] = snake_head_p
      snake_head_p = snake_head_p - 16
      eat_flag = false
      TRACE("length_index=%d",length_index)
      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[0]=%d",snake_body_p[0])
      break
     end if
    next length_index
    TRACE("snake_length=%d",snake_length)
   end if
   for count_index = 0 to 319 step 1
    snake_martix[count_index] = snake_pre_martix[count_index]
   next count_index
   snake_martix[snake_head_p] = 1
  else if snake_head_p <=15 then
   game_over = true
  end if
 else if direction == 2 then
  if snake_head_p <= 303 then
   if not eat_flag then
    snake_pre_martix[snake_cell_p] = 0
    snake_cell_p = snake_body_p[0]
    if snake_length>3 then
     for length_index = 0 to snake_length-4 step 1
      //temp_last_body = snake_length - 4
      temp_next_body = length_index + 1
      snake_body_p[length_index] = snake_body_p[temp_next_body]
     next length_index
    end if
    temp_body = snake_length-3
    snake_body_p[temp_body] = snake_head_p
    snake_head_p = snake_head_p + 16
    //snake_pre_martix[snake_cell_p] = 0
    //for length_index = snake_length down 3 step 1
    // temp_body = length_index-3
    // snake_cell_p = snake_body_p[temp_body]
    // snake_body_p[temp_body] = snake_head_p
    //next length_index
    //snake_head_p = snake_head_p + 16
   else if eat_flag then
    for length_index = 3 to 318 step 1
     if length_index == snake_length then
      temp_body = snake_length-3
      snake_body_p[temp_body] = snake_head_p
      snake_head_p = snake_head_p + 16
      eat_flag = false
      TRACE("length_index=%d",length_index)
      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[0]=%d",snake_body_p[0])
      break
     end if
    next length_index
   end if
   for count_index = 0 to 319 step 1
    snake_martix[count_index] = snake_pre_martix[count_index]
   next count_index
   snake_martix[snake_head_p] = 1
  else if snake_head_p > 303 then
   game_over = true
  end if
 else if direction == 3 then
  if snake_head_p<>0 and snake_head_p<>16 and snake_head_p<>32 and snake_head_p<>48 and snake_head_p<>64 and snake_head_p<>80 and snake_head_p<>96 and snake_head_p<>112 and snake_head_p<>128 and snake_head_p<>144 and snake_head_p<>160 and snake_head_p<>176 and snake_head_p<>192 and snake_head_p<>208 and snake_head_p<>224 and snake_head_p<>240 and snake_head_p<>256 and snake_head_p<>272 and snake_head_p<>288 and snake_head_p<>304 then 
   if not eat_flag then
    snake_pre_martix[snake_cell_p] = 0
    snake_cell_p = snake_body_p[0]
    if snake_length>3 then
     for length_index = 0 to snake_length-4 step 1
      //temp_last_body = snake_length - 4
      temp_next_body = length_index + 1
      snake_body_p[length_index] = snake_body_p[temp_next_body]
     next length_index
    end if
    temp_body = snake_length-3
    snake_body_p[temp_body] = snake_head_p
    snake_head_p = snake_head_p - 1
    
    //snake_pre_martix[snake_cell_p] = 0
    //for length_index = snake_length down 3 step 1
    // temp_body = length_index-3
    // snake_cell_p = snake_body_p[temp_body]
    // snake_body_p[temp_body] = snake_head_p
    //next length_index
    //snake_head_p = snake_head_p - 1
   else if eat_flag then
    for length_index = 3 to 318 step 1
     if length_index == snake_length then
      temp_body = snake_length-3
      snake_body_p[temp_body] = snake_head_p
      snake_head_p = snake_head_p - 1
      eat_flag = false
      TRACE("length_index=%d",length_index)
      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[0]=%d",snake_body_p[0])
      break
     end if
    next length_index
   end if      
   for count_index = 0 to 319 step 1
    snake_martix[count_index] = snake_pre_martix[count_index]
   next count_index
   snake_martix[snake_head_p] = 1
  else if snake_head_p==0 or snake_head_p==16 or snake_head_p==32 or snake_head_p==48 or snake_head_p==64 or snake_head_p==80 or snake_head_p==96 or snake_head_p==112 or snake_head_p==128 or snake_head_p==144 or snake_head_p==160 or snake_head_p==176 or snake_head_p==192 or snake_head_p==208 or snake_head_p==224 or snake_head_p==240 or snake_head_p==256 or snake_head_p==272 or snake_head_p==288 or snake_head_p==304 then
   game_over = true  
  end if
 else if direction == 4 then
  if snake_head_p<>15 and snake_head_p<>31 and snake_head_p<>47 and snake_head_p<>63 and snake_head_p<>79 and snake_head_p<>95 and snake_head_p<>111 and snake_head_p<>127 and snake_head_p<>143 and snake_head_p<>159 and snake_head_p<>175 and snake_head_p<>191 and snake_head_p<>207 and snake_head_p<>223 and snake_head_p<>239 and snake_head_p<>255 and snake_head_p<>271 and snake_head_p<>287 and snake_head_p<>303 and snake_head_p<>319 then
   if not eat_flag then
    snake_pre_martix[snake_cell_p] = 0
    snake_cell_p = snake_body_p[0]
    if snake_length>3 then
     for length_index = 0 to snake_length-4 step 1
      //temp_last_body = snake_length - 4
      temp_next_body = length_index + 1
      snake_body_p[length_index] = snake_body_p[temp_next_body]
     next length_index
    end if
    temp_body = snake_length-3
    snake_body_p[temp_body] = snake_head_p
    snake_head_p = snake_head_p + 1
    
    //snake_pre_martix[snake_cell_p] = 0
    //for length_index = snake_length down 3 step 1
    // temp_body = length_index-3
    // snake_cell_p = snake_body_p[temp_body]
    // snake_body_p[temp_body] = snake_head_p
    //next length_index
    //snake_head_p = snake_head_p + 1
   else if eat_flag then
    for length_index = 3 to 318 step 1
     if length_index == snake_length then
      temp_body = snake_length-3
      snake_body_p[temp_body] = snake_head_p
      snake_head_p = snake_head_p + 1
      eat_flag = false
      TRACE("length_index=%d",length_index)
      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])
      TRACE("snake_body_p[0]=%d",snake_body_p[0])
      break
     end if
    next length_index
   end if
   for count_index = 0 to 319 step 1
    snake_martix[count_index] = snake_pre_martix[count_index]
   next count_index
   snake_martix[snake_head_p] = 1

  else if snake_head_p==15 or snake_head_p==31 or snake_head_p==47 or snake_head_p==63 or snake_head_p==79 or snake_head_p==95 or snake_head_p==111 or snake_head_p==127 or snake_head_p==143 or snake_head_p==159 or snake_head_p==175 or snake_head_p==191 or snake_head_p==207 or snake_head_p==223 or snake_head_p==239 or snake_head_p==255 or snake_head_p==271 or snake_head_p==287 or snake_head_p==303 or snake_head_p==319 then
   game_over = true
  end if
 end if
 for display_index = 0 to 319 step 1
  //if display_index == snake_head_p or display_index == snake_body_p[0] or display_index == snake_cell_p then
  if snake_martix[display_index] == 1 then
   display_snake[display_index] = true
   display_init[display_index] = true
   //TRACE("snake_martix[display_index]=%d",snake_martix[display_index])
   //TRACE("display_index=%d",display_index)
  else if snake_martix[display_index] <> 1 then
   display_snake[display_index] = false
   display_init[display_index] = false 
  end if
  snake_pre_martix[display_index] = snake_martix[display_index]
 next display_index
 if next_point == snake_head_p then
  RAND(next_rand)
  next_point = next_rand/100
  if next_point >= 320 or next_point == snake_head_p or next_point == snake_body_p[0] or next_point == snake_cell_p then
   RAND(next_rand)
  end if
  next_point = next_rand/100
  snake_length = snake_length + 1
  eat_flag = true
  score = score + 1
  SetData(score, "Local HMI", RW, 20, 1)
 end if
 display_init[next_point] = true
 SetData(display_snake[0], "Local HMI", RW_Bit, 0.0, 320)
 SetData(display_init[0], "Local HMI", RW_Bit, 30.0, 320)
 if score>best_score then
  best_score = score
  SetData(score, "Local HMI", RW, 21, 1)
 end if
 DELAY(speed)
end if
if game_over then
 game_run = false
 SetData(bool_true, "Local HMI", LB, 100, 1)
 game_over = false
end if
if button_flag[0] then
 game_run = true
end if
if button_flag[1] then
 game_run = false
end if
end macro_command


  回复 引用 举报
chxkdy001 个人主页 给TA发消息 加TA为好友 发表于:2019-11-22 21:02:56 8楼
 

谢谢分享了。

  回复 引用 举报
都叫不好意思耽误了 个人主页 给TA发消息 加TA为好友 发表于:2019-11-24 00:17:39 9楼
 

下载下来学习学习

  回复 引用 举报
IE5338 个人主页 给TA发消息 加TA为好友 发表于:2019-11-24 13:21:19 10楼
 

威纶HMI-贪吃蛇游戏-能不能申精??http://bbs.957qao.com/D/201901/781402_1.shtml

分享一个应用宏指令制作的贪吃蛇游戏,http://bbs.957qao.com/d/201512/651815_1.shtml 

  回复 引用 举报
伟大古月 个人主页 给TA发消息 加TA为好友 发表于:2019-11-24 21:37:25 11楼
 

感谢分享,下载看看

  回复 引用 举报
snajdan111 个人主页 给TA发消息 加TA为好友 发表于:2019-11-26 10:52:04 12楼
 

感谢分享,下载学习

  回复 引用 举报
xingxuesnow 个人主页 给TA发消息 加TA为好友 发表于:2019-11-27 16:15:34 13楼
 



。感谢楼主 ,楼主辛苦

  回复 引用 举报
jkworld 个人主页 给TA发消息 加TA为好友 发表于:2019-12-01 11:12:33 14楼
 

下载学习研究,很不错的程序

  回复 引用 举报
行云168 个人主页 给TA发消息 加TA为好友 发表于:2019-12-02 08:17:03 15楼
 

下载学习研究,很不错的程序

  回复 引用 举报
liangxingzhi 个人主页 给TA发消息 加TA为好友 发表于:2019-12-02 15:02:22 16楼
 

谢谢楼主 啊

  回复 引用 举报
leisurefly 个人主页 给TA发消息 加TA为好友 发表于:2019-12-02 17:12:30 17楼
 

感觉很复杂呢,这思路不是一般人能够做的!

  回复 引用 举报
leisurefly 个人主页 给TA发消息 加TA为好友 发表于:2019-12-02 17:13:34 18楼
 

还有这贴得代码是在附件里面有的么,不是我说复制粘贴都要得一段时间

  回复 引用 举报
chenrenfu 个人主页 给TA发消息 加TA为好友 发表于:2019-12-02 21:02:59 19楼
 

下载下来看看!

  回复 引用 举报
y82223634 个人主页 给TA发消息 加TA为好友 发表于:2019-12-03 19:18:13 20楼
 

谢谢楼主分享

  回复 引用 举报
luyeh68 个人主页 给TA发消息 加TA为好友 发表于:2019-12-09 07:55:05 21楼
 

看看好玩吗

  回复 引用 举报
ibxip 个人主页 给TA发消息 加TA为好友 发表于:2019-12-09 12:06:52 22楼
 

不错 感谢分享。

  回复 引用 举报
瑾玉儿 个人主页 给TA发消息 加TA为好友 发表于:2019-12-10 11:59:43 23楼
 

哈哈哈,六啊 我上次还看见做扫雷的🤣

  回复 引用 举报
liangxingzhi 个人主页 给TA发消息 加TA为好友 发表于:2019-12-10 14:08:48 24楼
 

谢谢分享 好好学习,

  回复 引用 举报
问学_23 个人主页 给TA发消息 加TA为好友 发表于:2019-12-10 15:11:30 25楼
 


引用 Lonely_99 的回复内容: 谢谢楼主分享,已果断下载

-------------------------


  回复 引用 举报

周点击排行
周回复排行
最新求助

 幸运飞艇开奖 大福福彩 趣发福彩 九龙福彩 幸运飞艇开奖 千百万福彩 幸运飞艇开奖 优中福彩 大富贵福彩 趣赢福彩