Advertisement
pastamaker

wall, can choose image and dimensions here

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