Advertisement
pastamaker

gdip : snake +fruit & changing length

May 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. #Include,<gdip>
  7. SetBatchLines, -1
  8.  
  9.  
  10. pToken := Gdip_Startup()
  11.  
  12. global game:={h:500,w:500,x:100,y:100,t:700}
  13. global snake:={w:22,l:5}
  14. global pre_length:=5
  15. gui,1:  -caption +lastfound -dpiscale +E0x80000    +AlwaysOnTop
  16. GUI,1:Show,% "x" game.x " y" game.y " w" game.w " h" game.h
  17.  
  18. hwndl:=WinExist()
  19. pbrush1:=Gdip_BrushCreateSolid("0xffaf0c0b")
  20. pbrush2:=Gdip_BrushCreateSolid("0xff00ff00")
  21. pbrush3:=Gdip_BrushCreateSolid("0xff0000ff")
  22. pbrush4:=Gdip_BrushCreateSolid("0x00ffffff")
  23. pbrush5:=Gdip_BrushCreateSolid("0xffffffff")
  24. pbrush6:=Gdip_BrushCreateSolid("0xff0c00b0")
  25.  
  26. pPen1 := Gdip_CreatePenFromBrush(pBrush1, 30)
  27. pPen2 := Gdip_CreatePenFromBrush(pBrush2, 4)
  28.  
  29.  
  30.  
  31.  
  32.  
  33. hbm := CreateDIBSection(game.w, game.h)
  34.  
  35. hdc:=CreateCompatibleDC()
  36.  
  37. obm:=SelectObject(hdc,hbm )
  38.  
  39. G := Gdip_GraphicsFromHDC(hdc)
  40.  
  41. Gdip_SetSmoothingMode(G, 4)
  42.  
  43. ;~ Gdip_DrawRoundedRectangle(g, pPen1, 30, 30, 270, 270, 80)
  44. Gdip_FillRectangle(g, pBrush6, 0, 0, game.w, game.h)
  45.  
  46. ;~ ***********************************************************************
  47. ;~ ************************************************************************
  48. ;~ *************************************************************************
  49. global press:=[]
  50. press[1]:=1
  51. global x_border_left:=[]
  52. x_border_left[1]:=1
  53.  
  54.  
  55.  
  56. global x_border_right:=[]
  57. x_border_right[1]:=20
  58.  
  59.  
  60.  
  61. global y_border_up:=[]
  62. y_border_up[1]:=1
  63.  
  64.  
  65.  
  66. global y_border_down:=[]
  67. y_border_down[1]:=20
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. global  x_pos:=[]
  77. x_pos:= {1:7 ,2:7 ,3:7,4:7,5:7  }
  78.  
  79. global  y_pos:=[]
  80. y_pos:= {1:7 ,2:8 ,3:9,4:10,5:11  }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. global x_direction:= []
  87. x_direction:= [0,0,0,0,0]
  88.  
  89.  
  90. global y_direction:=[]
  91.  
  92. y_direction:= [-1,-1,-1,-1,-1]
  93.  
  94.  
  95. global  im_treasure:=[]
  96. im_treasure:= {1:0 ,2:0 ,3:0,4:0,5:0  }
  97.  
  98. global treasure_x:=[]
  99. global treasure_y:=[]
  100. treasure_x:=[5,7]
  101. treasure_y:=[7,4]
  102.  
  103.  
  104.  
  105.  
  106.  
  107. global pBitmapWin1 := Gdip_CreateBitmapFromFile("head_1200_no.png")
  108. global pBitmapWin2 := Gdip_CreateBitmapFromFile("head_0300_no.png")
  109. global pBitmapWin3 := Gdip_CreateBitmapFromFile("head_0600_no.png")
  110. global pBitmapWin4 := Gdip_CreateBitmapFromFile("head_0900_no.png")
  111. global pBitmapWin5 := Gdip_CreateBitmapFromFile("body_1200_no.png")
  112. global pBitmapWin6 := Gdip_CreateBitmapFromFile("body_0300_no.png")
  113. global pBitmapWin7 := Gdip_CreateBitmapFromFile("body_0130_no.png")
  114. global pBitmapWin8 := Gdip_CreateBitmapFromFile("body_0430_no.png")
  115. global pBitmapWin9 := Gdip_CreateBitmapFromFile("body_0730_no.png")
  116. global pBitmapWin10 := Gdip_CreateBitmapFromFile("body_1030_no.png")
  117. global pBitmapWin11 := Gdip_CreateBitmapFromFile("tail_1200_no.png")
  118. global pBitmapWin12 := Gdip_CreateBitmapFromFile("tail_0300_no.png")
  119. global pBitmapWin13 := Gdip_CreateBitmapFromFile("tail_0600_no.png")
  120. global pBitmapWin14 := Gdip_CreateBitmapFromFile("tail_0900_no.png")
  121.  
  122.  
  123.  
  124. global pBitmapWin1y := Gdip_CreateBitmapFromFile("head_1200_yes.png")
  125. global pBitmapWin2y := Gdip_CreateBitmapFromFile("head_0300_yes.png")
  126. global pBitmapWin3y := Gdip_CreateBitmapFromFile("head_0600_yes.png")
  127. global pBitmapWin4y := Gdip_CreateBitmapFromFile("head_0900_yes.png")
  128. global pBitmapWin5y := Gdip_CreateBitmapFromFile("body_1200_yes.png")
  129. global pBitmapWin6y := Gdip_CreateBitmapFromFile("body_0300_yes.png")
  130. global pBitmapWin7y := Gdip_CreateBitmapFromFile("body_0130_yes.png")
  131. global pBitmapWin8y := Gdip_CreateBitmapFromFile("body_0430_yes.png")
  132. global pBitmapWin9y := Gdip_CreateBitmapFromFile("body_0730_yes.png")
  133. global pBitmapWin10y := Gdip_CreateBitmapFromFile("body_1030_yes.png")
  134. global pBitmapWin11y := Gdip_CreateBitmapFromFile("tail_1200_yes.png")
  135. global pBitmapWin12y := Gdip_CreateBitmapFromFile("tail_0300_yes.png")
  136. global pBitmapWin13y := Gdip_CreateBitmapFromFile("tail_0600_yes.png")
  137.  
  138. global pBitmapWin14y := Gdip_CreateBitmapFromFile("tail_0900_yes.png")
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. global pBitmapWin_treasure := Gdip_CreateBitmapFromFile("black.png")
  149.  
  150.  
  151. global snake_mass:=[]
  152. snake_mass:= [pBitmapWin1,pBitmapWin5,pBitmapWin5,pBitmapWin5,pBitmapWin5]
  153.  
  154.  
  155.  
  156. ;~ d0:=30
  157. ;~ x0:=30
  158. ;~ y0:=30
  159. ;~ w0:=270
  160. ;~ h0:=270
  161. ;~ pPen1 := Gdip_CreatePenFromBrush(pBrush1, d0)
  162. ;~ Gdip_DrawRectangle(g, pPen1, x0+d0/2, y0+d0/2, w0-d0, h0-d0)
  163.  
  164. loop % x_border_left.MaxIndex() {
  165.    
  166.  
  167. ;~ pbrush=pbrush_border%A_Index%
  168. pbrush:=pbrush%A_Index%
  169. d0:=snake.w
  170. x0:=d0*x_border_left[A_Index]
  171. y0:=d0*y_border_up[A_Index]
  172. w0:=(x_border_right[A_Index] - x_border_left[A_Index] + 1)*d0
  173.  
  174. h0:=(y_border_down[A_Index] - y_border_up[A_Index] + 1)*d0
  175. ;~ MsgBox,% x0 " , " y0 " , " w0 " , " h0 " , " d0
  176. Gdip_DrawRectangle_2(g,pbrush,x0,y0,w0,h0,d0)
  177.  
  178.  
  179.  
  180. }
  181. ;~ x:=x0
  182. ;~ loop 2 {
  183.     ;~ y:=y0
  184.     ;~ loop 2 {
  185. ;~ Gdip_DrawEllipse(g, pPen2, x, y, 3, 3)
  186. ;~ y+=h0
  187.  
  188. ;~ }
  189. ;~ x+=w0
  190.  
  191.  
  192. ;~ }
  193.  
  194.  
  195.  
  196.  
  197. ;~ draw_snake(g,pbrush2,pbrush3)
  198.  
  199.  
  200.  
  201. UpdateLayeredWindow(hwndl, hdc, game.x, game.y, game.w, game.h)
  202.  
  203. settimer,tool,1
  204. SetTimer,game_loop,% game.t
  205. ;~ SetTimer,game_loop ,0
  206. return
  207. tool:
  208. ToolTip, % game.t
  209. return
  210. game_loop:
  211. press[1]:=1
  212.  
  213. set_pos()
  214.  
  215. bump_itself()
  216.  
  217. loop % x_border_left.MaxIndex() {
  218.    
  219.  
  220. d0:=snake.w
  221. x0:=d0*x_border_left[A_Index] +d0
  222. y0:=d0*y_border_up[A_Index] + d0
  223. w0:=(x_border_right[A_Index] - x_border_left[A_Index] - 1  )*d0
  224.  
  225. h0:=(y_border_down[A_Index] - y_border_up[A_Index] - 1 )*d0
  226. ;~ MsgBox,% x0 " , " y0 " , " w0 " , " h0 " , " d0
  227. Gdip_FillRectangle(g, pBrush6, x0, y0, w0, h0)
  228.  
  229.  
  230.  
  231. }
  232.  
  233. set_im_treasure()
  234. draw_treasure(g)
  235. set_direction()
  236. set_snake_mass()
  237. draw_snake(g,pbrush2,pbrush3)
  238. UpdateLayeredWindow(hwndl, hdc, game.x, game.y, game.w, game.h)
  239. max:=im_treasure.MaxIndex()
  240.     if(im_treasure[max] and pre_length = snake.l){
  241.         snake.l+=1
  242.         im_treasure.Insert(0)
  243.         x_pos.insert(x_pos[max]-x_direction[max])
  244.         y_pos.insert(y_pos[max]-y_direction[max])
  245.         x_direction.insert(x_direction[max])
  246.         y_direction.insert(y_direction[max])
  247.     }
  248.     else{
  249. pre_length:=snake.l    
  250. }
  251.    
  252. press[1]:=0
  253. return
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260. GuiClose:
  261. GuiEscape:
  262. *x::
  263. Gdip_Shutdown(pToken)
  264. ExitApp
  265.  
  266. Gdip_DrawRectangle_2(g,brush,x0,y0,w0,h0,d0){
  267.  
  268. pPen1 := Gdip_CreatePenFromBrush(Brush, d0)
  269. Gdip_DrawRectangle(g, pPen1, x0+d0/2, y0+d0/2, w0-d0, h0-d0)
  270.  
  271. ;~ pbrush:=Gdip_BrushCreateSolid("0xff000ff0")
  272. ;~ x:=x0
  273. ;~ loop 2 {
  274.     ;~ y:=y0
  275.     ;~ loop 2 {
  276. ;~ Gdip_fillEllipse(g, pbrush, x, y, 7, 7)
  277. ;~ y+=h0
  278.  
  279. ;~ }
  280. ;~ x+=w0
  281. ;~ }
  282.  
  283. }
  284.  
  285. ;~ draw_snake(g,brush_head,brush_body){
  286.    
  287.    
  288.     ;~ Gdip_fillRectangle(g,brush_head,x_pos[1]*snake.w,y_pos[ 1]*snake.w,snake.w,snake.w)
  289.     ;~ loop % snake.L -  1 {
  290.        
  291.    
  292.     ;~ Gdip_fillRectangle(g,brush_body,x_pos[A_Index + 1]*snake.w,y_pos[A_Index + 1]*snake.w,snake.w,snake.w)
  293.    
  294.    
  295. ;~ }
  296.    
  297.    
  298.    
  299. ;~ }
  300.    
  301.    
  302. draw_snake(g,brush_head,brush_body){
  303.    
  304.    
  305.    
  306.     loop % snake.L  {
  307.        
  308.    
  309.     ;~ Gdip_fillRectangle(g,brush_body,x_pos[A_Index + 1]*snake.w,y_pos[A_Index + 1]*snake.w,snake.w,snake.w)
  310.     Gdip_DrawImage(g, snake_mass[a_index],x_pos[A_Index ]*snake.w,y_pos[A_Index ]*snake.w,snake.w,snake.w)
  311.    
  312.    
  313. }
  314.    
  315.    
  316.    
  317. }
  318.     ;~ C:\Users\Admin\Desktop\gdip_snake\gdip_snake.ahk
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325. treasure(){
  326.    
  327.  
  328. qua:=treasure_x.MaxIndex()
  329. tt:=0
  330.  
  331. loop %qua% {
  332. tt++
  333.  
  334. if(treasure_x[tt] = x_pos[1] and treasure_y[tt] = y_pos[1]){
  335.     treasure_x[tt]:=-12
  336.     treasure_y[tt]:=-12
  337.  
  338.  
  339. return true
  340. }
  341.  
  342. }
  343. return false
  344. }
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375. set_snake_mass(){
  376.    
  377.     for i,val_x in x_direction {
  378.         val_y:=y_direction[i]
  379.     if(i<>1 and i<>snake.L){
  380.         base_turn(me,i)
  381.         if(im_treasure[i]=0){
  382.         (me="0730")?(val_x:=pBitmapWin7):(me="1030")?(val_x:=pBitmapWin8):(me="0130")?(val_x:=pBitmapWin9):(me="0430")?(val_x:=pBitmapWin10):(me="1200")?(val_x:=pBitmapWin5):(me="0300")?(val_x:=pBitmapWin6)
  383.     }
  384.     else{
  385.         (me="0730")?(val_x:=pBitmapWin7y):(me="1030")?(val_x:=pBitmapWin8y):(me="0130")?(val_x:=pBitmapWin9y):(me="0430")?(val_x:=pBitmapWin10y):(me="1200")?(val_x:=pBitmapWin5y):(me="0300")?(val_x:=pBitmapWin6y)
  386.    
  387.    
  388.    
  389. }
  390.     }
  391.     else if(i==1){
  392.         if(im_treasure[i]=0){
  393.         (val_y=-1)?(val_x:=pBitmapWin1):(val_y=1)?(val_x:=pBitmapWin3):(val_x=-1)?(val_x:=pBitmapWin4):(val_x=1)?(val_x:=pBitmapWin2)
  394.     }
  395.     else{
  396.         (val_y=-1)?(val_x:=pBitmapWin1y):(val_y=1)?(val_x:=pBitmapWin3y):(val_x=-1)?(val_x:=pBitmapWin4y):(val_x=1)?(val_x:=pBitmapWin2y)
  397. }
  398. }
  399. else if(i==snake.l) {
  400.     if(im_treasure[i]=0){
  401.     (val_y=-1)?(val_x:=pBitmapWin11):(val_y=1)?(val_x:=pBitmapWin13):(val_x=-1)?(val_x:=pBitmapWin14):(val_x=1)?(val_x:=pBitmapWin12)
  402. }
  403. if(im_treasure[i]=1){
  404.     (val_y=-1)?(val_x:=pBitmapWin11y):(val_y=1)?(val_x:=pBitmapWin13y):(val_x=-1)?(val_x:=pBitmapWin14y):(val_x=1)?(val_x:=pBitmapWin12y)
  405. }
  406. }
  407.     snake_mass[i]:=val_x
  408.  
  409. }
  410.    
  411. }
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.    
  428.    
  429.    
  430.    
  431. preset_pos(){
  432.    
  433.     for i,value in x_pos {
  434.        
  435.         x_pos[i]+=x_direction[i]
  436.         y_pos[i]+=y_direction[i]
  437.     }
  438.    
  439.    
  440. }
  441.  
  442. set_direction(){
  443.     max:=x_direction.MaxIndex()
  444.     loop % max - 1 {
  445.        
  446.         x_direction[max -A_Index + 1 ]:=x_direction[max - A_Index]
  447.         y_direction[max - A_Index + 1 ]:=y_direction[max - A_Index]
  448.     }
  449.    
  450.    
  451. }
  452.  
  453.  
  454. bump_itself(){
  455.    
  456.         for i,value in x_pos {
  457.        
  458.         if(i == 1)
  459.             continue
  460.         if(x_pos[1]==value and y_pos[1]==y_pos[i])
  461.         {
  462.             SoundBeep,250,1200
  463.             SetTimer,game_loop,off
  464.            
  465.         }
  466.     }
  467.    
  468.    
  469.    
  470.    
  471.    
  472.    
  473.    
  474.    
  475. }
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483. find_pitch(x,y){
  484.  
  485.     ;~ qua:=teleport.MaxIndex()
  486.     qua:=x_border_left.MaxIndex()
  487.    
  488. t:=0   
  489.     loop %qua% {
  490.     t++
  491.    
  492.    
  493.    
  494.     if( ( x <= x_border_right[t] ) and (  x >= x_border_left[t] ) and ( y <= y_border_down[t] ) and (  y >= y_border_up[t] ) )
  495.         return t
  496.    
  497. }
  498.    
  499.     MsgBox,wrong pitch
  500. }
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515. set_pos(){
  516.  
  517.  
  518. preset_pos()
  519. x:=x_pos[1]
  520. y:=y_pos[1]
  521. pitch :=find_pitch( x ,y )
  522.  
  523. out_of_border(pitch)
  524.  
  525.  
  526.  
  527.  
  528. }
  529.  
  530.  
  531. out_of_border( pitch ){
  532.  
  533. for i,value in x_pos {
  534. x:=x_pos[i]
  535. y:=y_pos[i]
  536. if(x = x_border_left[pitch]  ){
  537.  
  538. x:=x_border_right[pitch] - 1
  539.  
  540. }
  541.  
  542.  
  543.  
  544. if(x = x_border_right[pitch]  ){
  545.    
  546. x:=x_border_left[pitch] + 1
  547.  
  548. }
  549.  
  550. if(y = y_border_up[pitch]  ){
  551.  
  552.        
  553. y:=y_border_down[pitch] - 1
  554.  
  555. }
  556.  
  557. if(y = y_border_down[pitch] ){
  558.  
  559. y:=y_border_up[pitch] + 1
  560.  
  561. }
  562. x_pos[i]:=x
  563. y_pos[i]:=Y
  564. }
  565.  
  566.  
  567. }
  568.  
  569.  
  570. ;~ ***********************************************************************************************
  571.  
  572.  
  573. base_turn_6(ByRef turn , y_d, y_d_t){
  574. if( y_d =0 and y_d_t = 0  )
  575. turn:="0300"
  576. }
  577.  
  578. base_turn_5(ByRef turn , x_d, x_d_t){
  579. if( x_d =0 and x_d_t = 0  )
  580. turn:="1200"
  581. }
  582.  
  583. base_turn_1(ByRef turn,x_d, x_d_t, y_d , y_d_t){
  584. if((x_d = 1 and y_d_t = 1) or (y_d = -1 and x_d_t = -1))
  585. turn:="0130"
  586. }
  587.  
  588. base_turn_2(ByRef turn,x_d, x_d_t, y_d , y_d_t){
  589. if((y_d = 1 and x_d_t = -1) or (x_d = 1 and y_d_t = -1))
  590. turn:="0430"
  591. }
  592.  
  593. base_turn_3(ByRef turn,x_d, x_d_t, y_d , y_d_t){
  594. if((x_d = -1 and y_d_t = -1) or (y_d = 1 and x_d_t = 1))
  595. turn:="0730"
  596. }
  597.  
  598.  
  599. base_turn_4(ByRef turn,x_d, x_d_t, y_d , y_d_t){
  600. if((y_d = -1 and x_d_t = 1) or (x_d = -1 and y_d_t = 1))
  601. turn:="1030"
  602. }
  603.  
  604.  
  605. base_turn(ByRef turn,n){
  606.  
  607.     x_d:=x_direction[n]
  608.    
  609.     x_d_t:=x_direction[n+1]
  610.    
  611.    
  612.     y_d:=y_direction[n]
  613.  
  614.     y_d_t:=y_direction[n+1]
  615.    
  616.     base_turn_1(turn,x_d,x_d_t,y_d,y_d_t)
  617.     base_turn_2(turn,x_d,x_d_t,y_d,y_d_t)
  618.     base_turn_3(turn,x_d,x_d_t,y_d,y_d_t)
  619.     base_turn_4(turn,x_d,x_d_t,y_d,y_d_t)
  620.     base_turn_5(turn,x_d,x_d_t)
  621.     base_turn_6(turn,y_d,y_d_t)
  622. }
  623.  
  624.  
  625.  
  626.  
  627. ;~ ******************************************************
  628.  
  629. set_im_treasure(){
  630.    
  631.    
  632.     ;~ list:=""
  633.     max:=im_treasure.MaxIndex()
  634.     for i,value in im_treasure {
  635.     if(i == 1)  {
  636.    
  637.     }
  638.    
  639.     else {
  640.     im_treasure[max+2-i]:=  im_treasure[max+1-i]
  641. }
  642. ;~ list.=i " , " im_treasure[i] "`n"
  643.    
  644.  
  645.  
  646.  
  647. }
  648.  
  649.     im_treasure[1]:=0
  650.         if(treasure()){
  651.    
  652.         im_treasure[1]:=1
  653.        
  654.     }
  655.     ;~ tooltip,% game.t "`n" list
  656. }
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. a::
  668. X1:=x_direction[1]
  669. Y1:=Y_direction[1]
  670. if( x1 = 0 and press[1] = 0){
  671. y1:=0
  672. x1:=-1
  673. }
  674. x_direction[1]:=X1
  675. Y_direction[1]:=Y1
  676. return
  677.  
  678.  
  679. d::
  680. X1:=x_direction[1]
  681. Y1:=Y_direction[1]
  682. if( x1 = 0 and press[1] = 0){
  683. y1:=0
  684. x1:=1
  685. }
  686. x_direction[1]:=X1
  687. Y_direction[1]:=Y1
  688. return
  689.  
  690.  
  691.  
  692. w::
  693. X1:=x_direction[1]
  694. Y1:=Y_direction[1]
  695. if( Y1 = 0 and  press[1] = 0){
  696. y1:=-1
  697. x1:=0
  698. }
  699. x_direction[1]:=X1
  700. Y_direction[1]:=Y1
  701. return
  702.  
  703. S::
  704.  
  705. X1:=x_direction[1]
  706.  
  707. Y1:=Y_direction[1]
  708.  
  709.  
  710. if( Y1 = 0 and press[1] = 0){
  711. y1:=1
  712. x1:=0
  713. }
  714. x_direction[1]:=X1
  715.  
  716. Y_direction[1]:=Y1
  717.  
  718.  
  719. return
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734. 1::
  735. game.t-=5
  736. if(game.t < 5 )
  737.     game.t:=5
  738. SetTimer,game_loop,% game.t
  739. return
  740.  
  741.  
  742. 2::
  743. game.t+=5
  744. if(game.t > 3500 )
  745.     game.t:=3500
  746. SetTimer,game_loop,% game.t
  747. return
  748.  
  749.  
  750. 3::
  751. game.t-=1
  752. if(game.t < 1 )
  753.     game.t:=1
  754. SetTimer,game_loop,% game.t
  755. return
  756.  
  757.  
  758. 4::
  759. game.t+=1
  760. if(game.t > 3500 )
  761.     game.t:=3500
  762. SetTimer,game_loop,% game.t
  763. return
  764.  
  765.  
  766. draw_treasure(g){
  767.    
  768. for i,value in treasure_x {
  769.  
  770. Gdip_DrawImage(g, pBitmapWin_treasure,value*snake.w,treasure_y[i ]*snake.w,snake.w,snake.w)
  771.  
  772.  
  773. }
  774.    
  775.    
  776. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement