Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir%\png ; easy way to find images
- #SingleInstance,force
- SetBatchLines,-1
- #Include,<hellbents_gdip>
- BackWidth:=1024
- backHight:=576
- popUp:=Layered_Window_SetUp(4,50,50,BackWidth,576,1,"+alwaysontop")
- ;~ gui,1: show,,gui1
- backg:= new Back
- backg.set()
- types:=["idle","walk"]
- n:=10
- scale:=0.33
- photos := new Asset
- photos.set(types,n,scale)
- Alex := new Ninja
- alex.set(0,0,0,100,1,1,1,photos)
- loop {
- ;~ if(getkeystate("1"))
- ;~ alex.look:=1
- ;~ if(getkeystate("2"))
- ;~ alex.look:=2
- index:=mod(a_index,types.length())
- if(index=0)
- index:=types.length()
- loop 10 {
- Sleep 1000/24
- alex.phase:=A_Index
- alex.setv()
- alex.setxy()
- alex.setlook()
- alex.settype()
- alex.setmap()
- alex.stop()
- Gdip_GraphicsClear(popUp.g)
- ;~ fill_boxX(popup.g,"000000",0,0,popup.w,popup.h)
- backg.draw(popup.g)
- ToolTip,% backg.w
- ;~ map:=photos.asset[look][type][phase]
- ;~ ToolTip,% map
- ;~ Gdip_GetImageDimensions(map, w, h)
- ;~ Gdip_DrawImage(popup.g, map, 0,0,w, h)
- alex.draw(popUp.g)
- UpdateLayeredWindow(popUp.hwnd, popUp.hdc, popUp.x, popUp.y, popUp.w, popUp.h)
- }
- }
- return
- 1::
- return
- 2::
- return
- class Ninja {
- set(x,y,g,hight,look,type,phase,asset){
- this.asset:=asset
- this.x:=x
- this.y:=y
- this.vx:=0
- this.vy:=0
- this.g:=g
- this.hight:=hight
- this.look:=look
- this.type:=type
- this.phase:=phase
- this.setmap()
- }
- setVx(){
- vx:=5
- if(getkeystate("a"))
- this.vx:=-vx
- if(getkeystate("d"))
- this.vx:=vx
- }
- setVy(){
- vy:=5
- if(getkeystate("w"))
- this.vy:=-vy
- if(getkeystate("s"))
- this.vy:=vy
- }
- setv(){
- this.setvx()
- this.setvy()
- }
- stopX(){
- this.vx:=0
- }
- stopY(){
- this.vy:=0
- }
- stop(){
- this.stopx()
- this.stopy()
- }
- gVY(){
- this.vy+=this.g
- }
- setX(){
- this.x+=this.vx
- }
- sety(){
- this.y+=this.vy
- }
- setxy(){
- this.setx()
- this.sety()
- }
- setMap(){
- look:=this.look
- asset:=this.asset
- type:=this.type
- phase:=this.phase
- this.map:=asset.asset[look][type][phase]
- Gdip_GetImageDimensions(this.map, w, h)
- this.w:=w
- this.h:=h
- }
- setlook(){
- if(this.vx > 0)
- this.look := 1
- if(this.vx < 0)
- this.look := 2
- }
- SETTYPE(){
- IF(this.vx <> 0 && this.vy=0)
- this.type:= 2
- IF(this.vx = 0 && this.vy=0)
- this.type:= 1
- }
- draw(g){
- Gdip_DrawImage(g, this.map, THIS.X,this.y, this.w, this.h)
- }
- }
- class Asset {
- set(types,n,scale){
- a1:=[],a2:=[]
- b:=[a1,a2]
- this.asset:=b
- loop % types.MaxIndex() {
- Array:=[]
- fillArrayMap(Array , types[a_index],n, scale)
- this.asset[1].Insert(Array)
- Array2:=[]
- loop % n {
- Array2[A_Index]:=reverseMap(Array[A_Index])
- }
- this.asset[2].Insert(Array2)
- }
- }
- }
- reverseMap(map){
- Gdip_GetImageDimensions(map, w, h)
- newMap := Gdip_CreateBitmap(w, h)
- g := Gdip_GraphicsFromImage(newMap)
- Gdip_DrawImage(g, map, w,0, -w, h)
- return newmap
- }
- class Back {
- set(){
- back:=Gdip_CreateBitmapFromFile("back.png")
- this.back:=back
- Gdip_GetImageDimensions(back, w, h)
- this.w:=w
- this.h:=h
- }
- draw(g){
- Gdip_DrawImage(g, this.back, 0,0, this.w, this.h)
- }
- }
- fillArrayPng(byref array,string,n){
- loop % n {
- i:=A_Index
- tempStr=%string% (%i%).png
- Array[A_Index]:=tempStr
- ;~ ToolTip,% Array[A_Index]
- ;~ Sleep 250
- }
- }
- fillArrayMap(byref Array, string,n, scale){
- fillArrayPng(array,string,n)
- loop % n {
- map:=Array[A_Index]
- Map:=Gdip_CreateBitmapFromFile(map)
- map:=GDIP_SCALE(Map,1/SCALE)
- Array[A_Index]:=Map
- }
- }
- a::
- return
- s::
- return
- d::
- return
- w::
- return
- x::
- Layered_Window_ShutDown(popUp)
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement