Advertisement
pastamaker

FIXED WALL

Jun 7th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance,force
  2. SetBatchLines,-1
  3. #Include,<hellbents_gdip>
  4. popUp:=Layered_Window_SetUp(4,550,50,450,650,1,"+alwaysontop")
  5.  
  6.  
  7.  
  8. Fill_Boxx(pGraphics,colour,x,y,w,h)
  9.  
  10. fill_boxX(popUp.g,"000000",0,0,popUp.w,popUp.h)
  11. border:=new Outline
  12. border.set(10,410,10,600,15,25,15,5,"f00000","a00000")
  13. border.draw(popUp)
  14. jumpOnMe:=[]
  15. onWhatTojump :=new  Bars
  16. ;~ onWhatTojump.add(jumpOnMe,100,250,450,75,25,10,"000000")
  17.  
  18.  
  19.  
  20. onWhatTojump.draw(popUp,jumpOnMe)
  21. onWhatTojump.random:=0
  22.  
  23. ;nochotoy
  24. manual:=1
  25. toyMap:=Gdip_CreateBitmapFromFile("new.png")
  26. Gdip_GetImageDimensions(toyMap,  w,  h)
  27.  
  28. toySize:={w:w,h:h}
  29. if( manual <> 1){
  30.  
  31. toySize:={w:25,h:50}
  32. toyMap := Gdip_CreateBitmap(toySize.w, toySize.h)                    
  33. toyG := Gdip_GraphicsFromImage(toyMap)                              
  34. Gdip_SetSmoothingMode(toyG, 4)
  35. fill_boxX(toyG,"0000ff",0,0,toySize.w,toySize.h/2)
  36. fill_boxX(toyG,"00ff00",0,toySize.h/2,toySize.w,toySize.h/2)
  37. }
  38. bearToy:=new Nochotoy
  39.  
  40. bearToy.set((border.wx1+border.wx2)//2,border.wy1+toySize.h,3,0.04,13,toyMap,border)
  41.  
  42.  
  43.  
  44.  
  45. ;end nochotoy
  46.  
  47.  
  48. UpdateLayeredWindow(popUp.hwnd, popUp.hdc, popUp.x, popUp.y, popUp.w, popUp.h)
  49.  
  50.  
  51. loop  {
  52.     ToolTip,% beartoy.g
  53.         Sleep 50
  54.  
  55.     ;~ randomx(Me,Outline,w1,w2,h,v,colour){
  56. if(onWhatTojump.random < 0){
  57.    
  58.     onWhatTojump.randomx(5,7,jumpOnMe,border,100,150,10,2,colourGenerator())
  59.    
  60. }
  61. border.draw(popUp)
  62. ;~ bearToy.onWhatTojump.somewhere(bearToy,jumpOnMe)
  63. onWhatTojump.move(jumpOnMe)
  64. onWhatTojump.draw(popUp,jumpOnMe)
  65.  
  66.     bearToy.move(jumpOnMe,onWhatTojump)
  67. bearToy.draw(popUp)
  68. UpdateLayeredWindow(popUp.hwnd, popUp.hdc)
  69. onWhatTojump.somewhere(bearToy,jumpOnMe)
  70. bearToy.accident()
  71. }
  72.  
  73. class Outline{
  74.     set(x1,x2,y1,y2,wx1,wx2,wy1,wy2,colourBack,colourLine){
  75.         This.x1:=x1
  76.         This.x2:=x2
  77.         This.y1:=y1
  78.         This.y2:=y2
  79.         This.wx1:= wx1+x1
  80.         This.wx2:= -wx2+x2
  81.         This.wy1:= wy1+y1
  82.         This.wy2:= -wy2+y2
  83.         this.colourBack:=colourBack
  84.         this.colourLine:=colourLine
  85.  
  86.     }
  87.    
  88.     draw(popUp){
  89.        
  90.     fill_boxX(popUp.g,this.colourLine,this.x1,this.y1,this.x2-this.x1,this.y2-this.y1)
  91.     fill_boxX(popUp.g,this.colourBack,this.wx1,this.wy1,this.wx2-this.wx1,this.wy2-this.wy1)
  92.     }
  93.        
  94.  
  95.  
  96. }
  97.  
  98.  
  99. Class Bar{
  100.     set(x1,x2,y1,ymin,h,v,colour){
  101.         This.x1:=x1
  102.         This.x2:=x2
  103.         This.y1:=y1
  104.         This.ymin:=ymin
  105.         This.h:=h
  106.         This.v:=v
  107.         This.colour:=colour
  108.         this.deleteme:=0
  109.  
  110.  
  111.     }
  112.     undeR(x,y,w){
  113.         if(     x > this.x1 - w and  x < this.x2   and  y > this.y1)
  114.             return true
  115.         return false
  116.     }
  117.     abovE(x,y,w){
  118.         if(     x > this.x1 - w and  x < this.x2   and  y < this.y1)
  119.             return true
  120.         return false
  121.     }
  122.     wasAboveButNowUnderQ(x,y1,y2,w){
  123.         if(this.abovE(x,y1,w) and this.undeR(x,y2,w)){
  124.            
  125.            
  126.             return true
  127.         }
  128.         return false
  129.     }
  130.    
  131.     draw(popUp){
  132.         what:=2
  133.     fill_boxX(popUp.g,"000000",this.x1-what,this.y1-what,this.x2 - this.x1+what,this.h+what)
  134.     fill_boxX(popUp.g,this.colour,this.x1,this.y1,this.x2 - this.x1,this.h)
  135.    
  136.     ;~ fill_boxX(popUp.g,"ffffff",0,0,250,250)
  137.     }
  138.    
  139.     move(){
  140.    
  141.         This.y1+=THIS.V
  142.         this.delete()
  143.     }
  144.     delete(){
  145.     if(this.y1 + this.h > this.ymin )
  146.         this.deleteme:=1
  147.     }
  148.     here(toy){
  149.        
  150.         x1:=toy.x1
  151.         x2:=toy.x2
  152.         y2:=toy.y2
  153.         dHuP:=2
  154.         dHdowN:=5
  155.  
  156.         ;~ ToolTip,% x2 " > " this.x1 " and" x1 " < "  this.x2 " and" y2 " > " this.y1 - dHuP " and"   y2 " < " this.y1 + dHdowN
  157.         ;~ Sleep 2000
  158.         if(x2 > this.x1 and x1 < this.x2 and y2 > this.y1 - dHuP and y2 < this.y1 + dHdowN ){
  159.            
  160.             return true
  161.         }
  162.         return false
  163.     }
  164.  
  165. }
  166.  
  167. class Bars {
  168.     draw(popUp,Me){
  169.         for i,value in me {
  170.            
  171.             value.draw(popUp)
  172.         }
  173.        
  174.     }
  175.     somewhere(toy,me){
  176.         if(toy.g <> 0  )
  177.             return true
  178.         for i,value in me {
  179.             if(value.here(toy))
  180.                 return true
  181.         }
  182.        
  183.         toy.g:= 1
  184.         return false
  185.     }
  186.    
  187.     wherecollisionIs(me,x,y1,y2,w){
  188.         for i,value in me {
  189.             if(value.wasAboveButNowUnderQ(x,y1,y2,w))
  190.                 return i
  191.        
  192.         }
  193.         return 0
  194.        
  195.     }
  196.    
  197.     delete(Me){
  198.         t:=0
  199.         while(me.length() > t ){
  200.             t++
  201.             if(me[t].deleteme = 1)
  202.                 me.Remove(t)
  203.         }
  204.     }
  205.     add(Lim1,lim2,Me,x1,x2,y1,ymin,h,v,colour){
  206.         random,ran,lim1,lim2
  207.         this.random:= ran*h // v
  208.         that:= new Bar
  209.         that.set(x1,x2,y1,ymin,h,v,colour)
  210.         me.insert(that)
  211.     }
  212.    
  213.     move(me){
  214.         this.random--
  215.     for i,value in me
  216.         value.move()
  217.         this.delete(Me)
  218.     }
  219.     randomx(lim1,lim2,Me,Outline,w1,w2,h,v,colour){
  220.         random,ran,w1,w2
  221.         x1:=Outline.wx1
  222.         x2:=Outline.wx2
  223.         random,x1,x1,x2 - ran
  224.         y1:=Outline.wy1
  225.         ymin:=Outline.wy2
  226.        
  227.  
  228.        
  229.         this.add(lim1,lim2,Me,x1,x1+ran,y1,ymin,h,v,colour)
  230.     }
  231.  
  232. }
  233.  
  234. colourGenerator(){
  235.     a:=[]
  236.     a:=["1","2","3","4","5","6","7","8","9","a","b","c","d","f"]
  237.     colour=00
  238.         loop 4 {
  239.             Random,ran,1,15
  240.         new:=a[ran]
  241.             colour=%colour%%new%
  242.         }
  243.     return colour
  244. }
  245.  
  246.  
  247.  
  248. Class NoChoToy {
  249.     set(x,y,stepx,stepy,DefLeap,map,border){
  250.         This.map:=map
  251.         Gdip_GetImageDimensions(map,  w,  h)
  252.         This.x1:=x
  253.         This.x2:=x+w
  254.         This.y1:=y-h
  255.         This.y2:=y
  256.         This.vy:=0
  257.         This.W:=w
  258.         This.H:=h
  259.         This.G:= 1
  260.         This.stepy:=stepy
  261.         This.stepx:=stepx
  262.         This.leap:=1
  263.         this.defleap:=defLeap*defLeap
  264.         this.border:=Border
  265.         this.go:=0
  266.     }
  267.    
  268.     moveX(){
  269.         keyLeft:=GetKeyState("a")
  270.         keyRight:=GetKeyState("d")
  271.  
  272.         if(keyLeft){
  273.  
  274.             This.x1-=this.stepx
  275.             This.x2-=this.stepx
  276.         }
  277.         else if(keyRight){
  278.             This.x1+=this.stepx
  279.             This.x2+=this.stepx
  280.         }
  281.         if(this.x1 < this.border.wx1){
  282.             this.x1:=this.border.wx1
  283.             this.x2:=this.border.wx1 + this.w
  284.         }
  285.         else if(this.x2 > this.border.wx2){
  286.             this.x1:=this.border.wx2 - this.w
  287.             this.x2:=this.border.wx2
  288.             }
  289.         }
  290.         directionYOK(){
  291.             if(this.g = -1 and this.leap = 1)
  292.                 this.g:=1
  293.  
  294.             this.y1+= this.g*this.stepy*this.leap + this.vy
  295.             this.y2:=this.y1+this.h
  296.             this.leap+=this.g*2
  297.            
  298.         }
  299.         directionYSTOP(bar){
  300.             ;~ this.y1:=bar.y1 + bar.v
  301.             ;~ this.y2:=this.y1 + this.h
  302.             this.vy:=bar.v
  303.             this.g:=0
  304.             this.leap:=1
  305.         }
  306.         jumPY(){
  307.             keyUp:=GetKeyState("w")
  308.             if(keyUp and this.g = 0){
  309.                
  310.                 this.leap:=this.deFLeap
  311.                 this.g:=-1
  312.             }
  313.                
  314.         }
  315.        
  316.        
  317.         moveY(me,bars){
  318.             this.jumPY()
  319.             x:=this.x1
  320.             y1:=this.y2
  321.             y2:=this.y2 + this.stepy*this.leap*this.g
  322.             collision:=bars.wherecollisionIs(me,x,y1,y2,this.w)
  323.             if(collision = 0){
  324.                
  325.                 this.directionYOK()
  326.             }
  327.             else {
  328.            
  329.                 this.directionYSTOP(me[collision])
  330.             }
  331.                
  332.         }
  333.        
  334.         move(me,bars){
  335.            
  336.             key:=GetKeyState("s")
  337.             if(key)
  338.                 this.go:=1
  339.             if(this.go){
  340.                 this.moveY(me,bars)
  341.                 this.moveX()
  342.             }
  343.            
  344.            
  345.         }
  346.  
  347.         accident(){
  348.             if((this.y1 < this.border.wy1) or (this.y2 > this.border.wy2)){
  349.                 SoundBeep
  350.                 Sleep 1000
  351.                 gui,1:hide
  352.                 MsgBox,,,accident happened reload after 2 sec,2
  353.                 Reload
  354.             }
  355.         }
  356.         draw(popUp){
  357.             Gdip_DrawImage(popUp.g, this.map, this.x1,this.y1, this.w, this.h)
  358.         }
  359.     }
  360.  
  361.  
  362.  
  363. a::
  364. return
  365. s::
  366. return
  367. d::
  368. return
  369. w::
  370. return
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378. x::
  379. Layered_Window_ShutDown(popUp)
  380. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement