Advertisement
pastamaker

wall and bear

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