Advertisement
pastamaker

NINJAALEX

Jun 15th, 2018
107
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%\png ; easy way to find images
  5.  
  6.  
  7. #SingleInstance,force
  8. SetBatchLines,-1
  9. #Include,<hellbents_gdip>
  10. popUp:=Layered_Window_SetUp(4,50,50,600,600,1,"+alwaysontop")
  11. ;~ gui,1: show,,gui1
  12.  
  13. types:=["Attack__","Climb_","Dead__","Glide_","Idle__","Jump__","Jump_Attack__","jump_Throw__","Run__","Slide__","Throw__"]
  14.  
  15. slide:=[]
  16.  
  17.  
  18.  
  19.  
  20. n:=10
  21.  
  22. scale:=0.33
  23.  
  24. photos := new Asset
  25.  
  26. photos.set(types,n,scale)
  27.  
  28. Alex := new Ninja
  29.  
  30. alex.set(0,0,0,100,1,1,1,photos)
  31.  
  32. loop  {
  33.     ;~ if(getkeystate("1"))
  34.         ;~ alex.look:=1
  35.     ;~ if(getkeystate("2"))
  36.         ;~ alex.look:=2
  37.    
  38.     index:=mod(a_index,types.length())
  39.     if(index=0)
  40.         index:=types.length()
  41.     alex.type:=index
  42.    
  43.    
  44.  
  45.  
  46.  
  47.     loop 10 {
  48.        
  49.     Sleep 1000/24
  50.    
  51.     alex.phase:=A_Index
  52.     alex.setv()
  53.     alex.setxy()
  54.  
  55.     alex.setlook()
  56.     alex.setmap()
  57.     alex.stop()
  58.     Gdip_GraphicsClear(popUp.g)
  59.     fill_boxX(popup.g,"000000",0,0,popup.w,popup.h)
  60.     ;~ map:=photos.asset[look][type][phase]
  61.    
  62.     ;~ ToolTip,% map
  63.     ;~ Gdip_GetImageDimensions(map,  w,  h)
  64.  
  65.     ;~ Gdip_DrawImage(popup.g, map, 0,0,w, h)
  66.    
  67.     alex.draw(popUp.g)
  68.    
  69.     UpdateLayeredWindow(popUp.hwnd, popUp.hdc, popUp.x, popUp.y, popUp.w, popUp.h)
  70.     }
  71. }
  72.  
  73.  
  74. return
  75.  
  76.  
  77. 1::
  78. return
  79. 2::
  80. return
  81.  
  82.  
  83.  
  84.  
  85. class Ninja {
  86.    
  87.     set(x,y,g,hight,look,type,phase,asset){
  88.        
  89.         this.asset:=asset
  90.         this.x:=x
  91.         this.y:=y
  92.         this.vx:=0
  93.         this.vy:=0
  94.         this.g:=g
  95.         this.hight:=hight
  96.         this.look:=look
  97.         this.type:=type
  98.         this.phase:=phase
  99.         this.setmap()
  100.        
  101.     }
  102.     setVx(){
  103.         vx:=5
  104.         if(getkeystate("a"))
  105.             this.vx:=-vx
  106.         if(getkeystate("d"))
  107.             this.vx:=vx
  108.     }
  109.         setVy(){
  110.         vy:=5
  111.         if(getkeystate("w"))
  112.             this.vy:=-vy
  113.         if(getkeystate("s"))
  114.             this.vy:=vy
  115.     }
  116.     setv(){
  117.         this.setvx()
  118.         this.setvy()
  119.     }
  120.     stopX(){
  121.         this.vx:=0
  122.     }
  123.     stopY(){
  124.         this.vy:=0
  125.     }
  126.     stop(){
  127.         this.stopx()
  128.         this.stopy()
  129.     }
  130.     gVY(){
  131.         this.vy+=this.g
  132.     }
  133.     setX(){
  134.         this.x+=this.vx
  135.     }
  136.     sety(){
  137.         this.y+=this.vy
  138.     }
  139.     setxy(){
  140.         this.setx()
  141.         this.sety()
  142.    
  143.     }
  144.     setMap(){
  145.         look:=this.look
  146.         asset:=this.asset
  147.         type:=this.type
  148.         phase:=this.phase
  149.         this.map:=asset.asset[look][type][phase]
  150.    
  151.         Gdip_GetImageDimensions(this.map,  w,  h)
  152.         this.w:=w
  153.         this.h:=h
  154.     }
  155.     setlook(){
  156.         if(this.vx > 0)
  157.             this.look := 1
  158.         if(this.vx < 0)
  159.             this.look := 2
  160.     }
  161.     draw(g){
  162.         Gdip_DrawImage(g, this.map, THIS.X,this.y, this.w, this.h)
  163.        
  164.     }
  165.    
  166. }
  167.  
  168. class Asset {
  169.  
  170.     set(types,n,scale){
  171.         a1:=[],a2:=[]
  172.         b:=[a1,a2]
  173.         this.asset:=b
  174.         loop % types.MaxIndex() {
  175.             Array:=[]
  176.             fillArrayMap(Array , types[a_index],n, scale)
  177.             this.asset[1].Insert(Array)
  178.        
  179.             Array2:=[]
  180.             loop % n {
  181.                 Array2[A_Index]:=reverseMap(Array[A_Index])
  182.            
  183.             }
  184.            
  185.            
  186.             this.asset[2].Insert(Array2)
  187.         }
  188.    
  189.        
  190.     }
  191.  
  192. }
  193.  
  194.  
  195.  
  196.  
  197. reverseMap(map){
  198.     Gdip_GetImageDimensions(map,  w,  h)
  199.     newMap := Gdip_CreateBitmap(w, h)                      
  200.     g := Gdip_GraphicsFromImage(newMap)
  201.     Gdip_DrawImage(g, map, w,0, -w, h)
  202.     return newmap  
  203. }
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. fillArrayPng(byref array,string,n){
  217.     loop % n {
  218.         i:=A_Index - 1
  219.         tempStr=%string%00%i%.png
  220.         Array[A_Index]:=tempStr
  221.         ;~ ToolTip,% Array[A_Index]
  222.         ;~ Sleep 250
  223.  
  224.        
  225.     }
  226. }
  227.  
  228. fillArrayMap(byref Array, string,n, scale){
  229.    
  230.     fillArrayPng(array,string,n)
  231.     loop % n {
  232.         map:=Array[A_Index]
  233.         Map:=Gdip_CreateBitmapFromFile(map)
  234.         map:=GDIP_SCALE(Map,1/SCALE)
  235.         Array[A_Index]:=Map
  236.        
  237.     }
  238.  
  239.    
  240. }
  241. a::
  242. return
  243. s::
  244. return
  245. d::
  246. return
  247. w::
  248. return
  249. x::
  250. Layered_Window_ShutDown(popUp)
  251. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement