Advertisement
pastamaker

alexNINJA2

Jun 15th, 2018
99
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.    
  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.settype()
  57.     alex.setmap()
  58.    
  59.     alex.stop()
  60.     Gdip_GraphicsClear(popUp.g)
  61.     fill_boxX(popup.g,"000000",0,0,popup.w,popup.h)
  62.     ;~ map:=photos.asset[look][type][phase]
  63.    
  64.     ;~ ToolTip,% map
  65.     ;~ Gdip_GetImageDimensions(map,  w,  h)
  66.  
  67.     ;~ Gdip_DrawImage(popup.g, map, 0,0,w, h)
  68.    
  69.     alex.draw(popUp.g)
  70.    
  71.     UpdateLayeredWindow(popUp.hwnd, popUp.hdc, popUp.x, popUp.y, popUp.w, popUp.h)
  72.     }
  73. }
  74.  
  75.  
  76. return
  77.  
  78.  
  79. 1::
  80. return
  81. 2::
  82. return
  83.  
  84.  
  85.  
  86.  
  87. class Ninja {
  88.    
  89.     set(x,y,g,hight,look,type,phase,asset){
  90.        
  91.         this.asset:=asset
  92.         this.x:=x
  93.         this.y:=y
  94.         this.vx:=0
  95.         this.vy:=0
  96.         this.g:=g
  97.         this.hight:=hight
  98.         this.look:=look
  99.         this.type:=type
  100.         this.phase:=phase
  101.         this.setmap()
  102.        
  103.     }
  104.     setVx(){
  105.         vx:=5
  106.         if(getkeystate("a"))
  107.             this.vx:=-vx
  108.         if(getkeystate("d"))
  109.             this.vx:=vx
  110.     }
  111.         setVy(){
  112.         vy:=5
  113.         if(getkeystate("w"))
  114.             this.vy:=-vy
  115.         if(getkeystate("s"))
  116.             this.vy:=vy
  117.     }
  118.     setv(){
  119.         this.setvx()
  120.         this.setvy()
  121.     }
  122.     stopX(){
  123.         this.vx:=0
  124.     }
  125.     stopY(){
  126.         this.vy:=0
  127.     }
  128.     stop(){
  129.         this.stopx()
  130.         this.stopy()
  131.     }
  132.     gVY(){
  133.         this.vy+=this.g
  134.     }
  135.     setX(){
  136.         this.x+=this.vx
  137.     }
  138.     sety(){
  139.         this.y+=this.vy
  140.     }
  141.     setxy(){
  142.         this.setx()
  143.         this.sety()
  144.    
  145.     }
  146.     setMap(){
  147.         look:=this.look
  148.         asset:=this.asset
  149.         type:=this.type
  150.         phase:=this.phase
  151.         this.map:=asset.asset[look][type][phase]
  152.    
  153.         Gdip_GetImageDimensions(this.map,  w,  h)
  154.         this.w:=w
  155.         this.h:=h
  156.     }
  157.     setlook(){
  158.         if(this.vx > 0)
  159.             this.look := 1
  160.         if(this.vx < 0)
  161.             this.look := 2
  162.     }
  163.     SETTYPE(){
  164.         IF(this.vy > 0)
  165.             this.type:= 4
  166.         IF(this.vy < 0)
  167.             this.type:= 2
  168.         ;~ IF(this.vy = 0)
  169.             ;~ this.type:= 1
  170.         IF(this.vx <> 0  && this.vy=0)
  171.             this.type:= 9
  172.         IF(this.vx = 0 && this.vy=0)
  173.             this.type:= 5
  174.  
  175.     }
  176.     draw(g){
  177.         Gdip_DrawImage(g, this.map, THIS.X,this.y, this.w, this.h)
  178.        
  179.     }
  180.    
  181. }
  182.  
  183. class Asset {
  184.  
  185.     set(types,n,scale){
  186.         a1:=[],a2:=[]
  187.         b:=[a1,a2]
  188.         this.asset:=b
  189.         loop % types.MaxIndex() {
  190.             Array:=[]
  191.             fillArrayMap(Array , types[a_index],n, scale)
  192.             this.asset[1].Insert(Array)
  193.        
  194.             Array2:=[]
  195.             loop % n {
  196.                 Array2[A_Index]:=reverseMap(Array[A_Index])
  197.            
  198.             }
  199.            
  200.            
  201.             this.asset[2].Insert(Array2)
  202.         }
  203.    
  204.        
  205.     }
  206.  
  207. }
  208.  
  209.  
  210.  
  211.  
  212. reverseMap(map){
  213.     Gdip_GetImageDimensions(map,  w,  h)
  214.     newMap := Gdip_CreateBitmap(w, h)                      
  215.     g := Gdip_GraphicsFromImage(newMap)
  216.     Gdip_DrawImage(g, map, w,0, -w, h)
  217.     return newmap  
  218. }
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231. fillArrayPng(byref array,string,n){
  232.     loop % n {
  233.         i:=A_Index - 1
  234.         tempStr=%string%00%i%.png
  235.         Array[A_Index]:=tempStr
  236.         ;~ ToolTip,% Array[A_Index]
  237.         ;~ Sleep 250
  238.  
  239.        
  240.     }
  241. }
  242.  
  243. fillArrayMap(byref Array, string,n, scale){
  244.    
  245.     fillArrayPng(array,string,n)
  246.     loop % n {
  247.         map:=Array[A_Index]
  248.         Map:=Gdip_CreateBitmapFromFile(map)
  249.         map:=GDIP_SCALE(Map,1/SCALE)
  250.         Array[A_Index]:=Map
  251.        
  252.     }
  253.  
  254.    
  255. }
  256. a::
  257. return
  258. s::
  259. return
  260. d::
  261. return
  262. w::
  263. return
  264. x::
  265. Layered_Window_ShutDown(popUp)
  266. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement