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>
- popUp:=Layered_Window_SetUp(4,50,50,A_ScreenWidth,A_ScreenHeight,1,"+alwaysontop")
- ;~ gui,1: show,,gui1
- types:=["Attack__","Climb_","Dead__","Glide_","Idle__","Jump__","Jump_Attack__","jump_Throw__","Run__","Slide__","Throw__"]
- slide:=[]
- backg:= new Back
- backg.set()
- n:=10
- scale:=0.3
- photos := new Asset
- photos.set(types,n,scale)
- Alex := new Ninja
- alex.set(500,500,20,100,1,1,1,photos,backg)
- highter:= new Ladder
- highter.set(500,20,scale)
- swords := new Knives
- swords.set(0.3,backg)
- k:=2
- loop {
- ;~ if(getkeystate("1"))
- ;~ alex.look:=1
- ;~ if(getkeystate("2"))
- ;~ alex.look:=2
- loop 10 {
- ;~ Sleep 1000/10
- ;~ alex.setv()
- ;~ alex.setlook()
- ;~ alex.setxy()
- ;~ alex.border()
- ;~ alex.settype()
- ;~ alex.setmap()
- ;~ alex.stop()
- Sleep 1000/24
- alex.setv()
- alex.setlook()
- alex.setmap()
- alex.setxy()
- alex.border()
- alex.settype()
- if(getkeystate("q") and (alex.vx <> 0 or alex.vy <> 0)){
- x1:=(alex.x1 + alex.x2) / 2
- y1:=(alex.y1 + alex.y2) / 2
- vx:=alex.vx*k
- vy:=alex.vy*k
- swords.add(x1,y1,vx,vy,1)
- }
- alex.stop()
- Gdip_GraphicsClear(popUp.g)
- ;~ fill_boxX(popup.g,"000000",0,0,popup.w,popup.h)
- backg.draw(popup.g)
- ;~ map:=photos.asset[look][type][phase]
- ;~ ToolTip,% map
- ;~ Gdip_GetImageDimensions(map, w, h)
- ;~ Gdip_DrawImage(popup.g, map, 0,0,w, h)
- highter.draw(popup.g)
- alex.draw(popUp.g)
- swords.move()
- swords.delete()
- swords.draw(popup.g)
- UpdateLayeredWindow(popUp.hwnd, popUp.hdc, popUp.x, popUp.y, popUp.w, popUp.h)
- }
- }
- return
- 1::
- return
- 2::
- return
- q::
- return
- class Ninja {
- set(x1,y1,g,hight,look,type,phase,asset,Backscene){
- this.asset:=asset
- this.x1:=x1
- this.y1:=y1
- This.x2 := x2
- This.y2 := y2
- this.vx:=0
- this.vy:=0
- this.g:=g
- this.hight:=hight
- this.look:=look
- this.type:=type
- this.phase:=phase
- this.setmap()
- this.Backscene:=Backscene
- }
- setVx(){
- vx:=20
- if(getkeystate("a"))
- this.vx:=-vx
- if(getkeystate("d"))
- this.vx:=vx
- }
- setVy(){
- vy:=75
- pass:=false
- if(this.vy = 0)
- pass:=true
- this.gVY()
- if(getkeystate("w") and pass){
- 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(){
- if(this.look = 1){
- this.x1+=this.vx
- this.x2:=this.x1 + this.w
- }
- if(this.look = 2){
- this.x2+=this.vx
- this.x1:=this.x2 - this.w
- }
- }
- sety(){
- this.y2+=this.vy
- this.y1:=this.y2 - this.h
- }
- 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
- }
- border(){
- if(this.x1 < this.Backscene.x1){
- this.x1:=this.Backscene.x1
- this.x2:=this.x1 + this.w
- this.vx:=0
- }
- else if(this.x2 > this.Backscene.x2){
- this.x2:=this.Backscene.x2
- this.x1:=this.x2 - this.w
- this.vx:=0
- }
- if(this.y1 < this.Backscene.y1){
- this.y1:=this.Backscene.y1
- this.y2:=this.y1 + this.h
- this.vy:=0
- }
- else if(this.y2 > this.Backscene.y2){
- this.y2:=this.Backscene.y2
- this.y1:=this.y2 - this.h
- this.vy:=0
- }
- }
- SETTYPE(){
- IF(this.vy > 0){
- ;~ SoundBeep
- ;~ if(this.type <> 6 )
- ;~ this.phase:=1
- ;~ else {
- ;~ if(this.phase < 9)
- ;~ this.phase++
- ;~ }
- this.type:= 6
- if(this.type <> 6 )
- this.phase:=1
- else {
- if(this.phase <> 9)
- this.phase+=1
- }
- }
- IF(this.vy < 0) {
- if(this.type <> 6 )
- this.phase:=1
- else {
- if(this.phase <> 9)
- this.phase+=1
- }
- this.type:= 6
- ;~ IF(this.vy = 0)
- ;~ this.type:= 1
- }
- IF(this.vx <> 0 && this.vy=0) {
- this.type:= 9
- phase:= mod(this.phase + 1 ,10)
- if(phase = 0)
- phase:=10
- this.phase:=phase
- }
- IF(this.vx = 0 && this.vy=0) {
- this.type:= 5
- phase:= mod(this.phase + 1 ,10)
- if(phase = 0)
- phase:=10
- this.phase:=phase
- }
- }
- draw(g){
- Gdip_DrawImage(g, this.map, THIS.X1,this.y1, 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
- }
- fillArrayPng(byref array,string,n){
- loop % n {
- i:=A_Index - 1
- tempStr=%string%00%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
- }
- }
- class Back {
- set(){
- back:=Gdip_CreateBitmapFromFile("back.png")
- this.back:=back
- Gdip_GetImageDimensions(back, w, h)
- this.w:=w
- this.h:=h
- delta:=14
- This.x1 := delta
- This.x2 := w - delta
- This.y1 := delta
- This.y2 := h - delta
- }
- draw(g){
- Gdip_DrawImage(g, this.back, 0,0, this.w, this.h)
- }
- }
- class Ladder {
- set(x1,y1,scale){
- map:=map:=Gdip_CreateBitmapFromFile("ladder.png")
- map:=GDIP_SCALE(Map,1/SCALE)
- This.map := map
- Gdip_GetImageDimensions(MAP, w, h)
- this.w:=w
- this.h:=h
- This.x1 := x1
- This.x2 := x1 + w
- This.y1 := y1
- This.y2 := y1 + h
- }
- draw(g){
- h := This.h
- w := This.w
- map := This.map
- x1 := This.x1
- y1 := This.y1
- Gdip_DrawImage(g, map, x1, y1 ,w,h)
- }
- here(hero){
- if( ){
- SoundBeep
- if(hero.look = 1){
- HERO.X1:=THIS.X1
- HERO.X2:=HERO.X1 + HERO.W
- HERO.Y2:=THIS.Y2
- HERO.Y1:=HERO.Y2 - HERO.H
- }
- else if(hero.look = 2){
- HERO.X2:=THIS.X2
- HERO.X1:=HERO.X2 - HERO.W
- HERO.Y2:=THIS.Y2
- HERO.Y1:=HERO.Y2 - HERO.H
- }
- }
- }
- }
- class Kunai {
- set(x3,y3,vx,vy,scale,phase){
- Map:=Gdip_CreateBitmapFromFile("kunai.png")
- map:=GDIP_SCALE(Map,1/SCALE)
- This.map := map
- this.maps()
- This.x3 := x3
- This.y3 := y3
- this.phase:=phase
- This.vx := vx
- This.vy := vy
- w:=this.setOFmaps.w[this.phase]
- h:=this.setOFmaps.h[this.phase]
- This.x1 := x3 - w/2
- This.y1 := y3 - h/2
- This.x2 := x3 + w/2
- This.y2 := y3 + h/2
- }
- changephase(){
- phase:=mod(this.phase + 2,36)
- if(phase = 0)
- phase := 1
- this.phase:=phase
- }
- move(){
- This.x3 += this.vx
- This.y3 += this.vy
- this.changephase()
- w:=this.setOFmaps.w[this.phase]
- h:=this.setOFmaps.h[this.phase]
- This.x1 := This.x3 - w/2
- This.y1 := This.y3 - h/2
- This.x2 := This.x3 + w/2
- This.y2 := This.y3 + h/2
- }
- maps(){
- a:=[],b:=[],c:=[]
- this.setOFmaps:={w:a,h:b,map:c}
- loop 36 {
- map0:=this.map
- i:=A_Index - 1
- angle := i*10
- turn_bitmap(map0,angle)
- this.setOFmaps.map.insert(map0)
- Gdip_GetImageDimensions(map0, w, h)
- this.setOFmaps.w.insert(w)
- this.setOFmaps.h.insert(h)
- }
- }
- draw(g){
- phase:=this.phase
- w:=this.setOFmaps.w[phase]
- h:=this.setOFmaps.h[phase]
- map:=this.setOFmaps.map[phase]
- Gdip_DrawImage(g, map, this.x3 - w/2,this.y3 - h/2, w, h,0,0,w,h)
- }
- }
- class Knives {
- set(scale,backg){
- this.scale:=scale
- This.x1 := backg.x1
- This.x2 := backg.x2
- This.y1 := backg.y1
- This.y2 := backg.y2
- }
- add(x3,y3,vx,vy,phase){
- scale := This.scale
- if(this.array.length() = "" )
- this.array:=[]
- knife:= new Kunai
- knife.set(x3,y3,vx,vy,scale,phase)
- this.Array.insert(knife)
- }
- move(){
- for i,value in this.array {
- value.move()
- }
- }
- delete(){
- x1:=This.x1
- x2:=This.x2
- y1:=This.y1
- y2:=This.y2
- for i,value in this.array {
- x1k:=value.x1
- x2k:=value.x2
- y1k:=value.y1
- y2k:=value.y2
- if(x1k < x1 or y1k < y1 or x2k > x2 or y2k > y2 )
- this.array.remove(i)
- }
- }
- draw(g){
- for i,value in this.array {
- value.draw(g)
- }
- }
- }
- a::
- return
- s::
- return
- d::
- return
- w::
- return
- x::
- Layered_Window_ShutDown(popUp)
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement