GRAWP001 REALNAME Hookshot2 IMAGE rha_hookshot_icon.png SCRIPT if (playertouchsme && !isweapon) { if (!Obtained_Hookshot_1) { set Obtained_Hookshot_1; setstring Hookshot_Level,1; } toweapons Hookshot2; } if ((created || playerenters) && isweapon) { this.pull_items = { 0, 1, 2, 3, 4, 5, 19 }; this.tiles_grab = { 0x674,0x675,0x14A,0x14B,0x7E0,0x7E1, 0x684,0x685,0x15A,0x15B,0x7F0,0x7F1, 0x146,0x147,0x148,0x149,0x156,0x157,0x158,0x159, 0xE88,0xE89,0xE98,0xE99, 0xD6B,0xD37,0xD47 }; this.tiles_pass = { 0x111,0x137,0x1AA,0x137,0x113,0x121,0x122,0x1BA,0x122,0x123, 0xD2,0x18D,0x114,0x18D, 0xD4, 0xE2, 0xD3,0x124, 0xE3, 0xE4, 0xB9, 0xBA, 0xC9, 0xCA, 0xD9, 0xDA, 0xE9, 0xEA, 0xF9, 0xFA, 0x9F, 0x9E, 0xAE, 0xAF, 0x98, 0x99,0x12E,0x12F, 0x98, 0x99, 0xBF, 0xBE,0x17D, 0xB8,0x171, 0xD8,0x180, 0xF8,0x17E, 0xBB, 0xDE, 0xEE, 0xFE, 0xFB,0x104,0x103,0x103,0x103,0x102,0x120, 0xF1, 0xF2, 0xF2, 0xF2, 0xF3, 0xB5,0x112,0x107,0x117,0x235, 0xA9, 0xA9, 0xB9, 0xBA, 0xC9, 0xCA, 0xD9, 0xDA, 0xE9, 0xEA, 0x22E,0x22F,0x23E,0x23F, 0xEC, 0xFC, 0xBB, 0xDE, 0xEE, 0xFE, 0x126, 0xE7, 0xF7, 0xB8,0x181,0x180,0x236,0x110, 0xD5,0x3CD, 0x3BD,0x132,0x131,0x11E,0x11F, 0xF3, 0xF4, 0xF5,0x102,0x101, 0x100,0x131,0x132,0x3CD,0x3BD,0x1CE,0x1DE,0x108,0x118, 0xC8, 0xCB, 0xDB,0x1CF,0x1DF,0x232,0x242,0x233,0x243,0x191, 0xEF, 0x29F,0x29E,0x1DC,0xAC2,0x19C,0x1CA,0x1AC,0x1BC, 0xE8, 0xA7, 0xB7, 0xC7, 0xD7, 0xAC, 0xBC, 0xCC, 0xDC, 0xD6, 0xDD, 0xFF, 0xAC3,0x1FC,0x1FD,0xE3C,0x161,0x153,0x154,0x24D,0x1EC, 0x11, 0x60, 0x11, 0x21, 0x70, 0x20, 0x2, 0x3, 0x12, 0x13, 0x22, 0x23, 0x32, 0x33, 0x3DE,0x3DF,0x3EE,0x3EF, 0xD20,0xD21,0xD30,0xD31,0xD10,0xD11, 0xE7E,0xE7F,0xE8E,0xE8F, }; this.mode=0; } if (weaponfired) { this.hook={ playerx+1+(vecx(playerdir)*1.5), playery+2+(vecy(playerdir)*1.5) }; if ( this.mode==0 && !(onwall( this.hook[0],this.hook[1] ) && !(tiles[int(this.hook[0]), int(this.hook[1])] in this.tiles_pass)) ) { this.mode=1; CreateInitialValues(); freezeplayer 0.25; setani rha_hookshot_shoot,; timeout=0.25; } else if ( this.mode != 0 ) { this.mode = 2; timeout=0.05; } } if (playerhurt) { if (this.mode != 0) { this.mode=0; timeout=0.05; } } if (timeout) { if ( keydown(4) && this.mode==1 && this.distance_fly>4 ) this.mode=2; if (this.mode==1) { for ( this.j = 0; this.j < this.speed; this.j++ ) { this.distance_fly++; DrawHookshot(); if ( this.distance_fly >= this.distance_fly_max ) { this.mode=2; this.j=this.speed; } CheckHit(); if ( this.mode != 1 ) this.j=this.speed; } freezeplayer 0.05; timeout=0.05; } else if (this.mode==2) { for ( this.j = 0; this.j < this.speed; this.j++ ) { this.distance_fly--; hideimg 10+this.distance_fly+1; DrawHookshot(); CheckHit(); if (this.distance_fly<=0) { this.mode=0; this.j=this.speed; } } freezeplayer 0.05; timeout=0.05; } else if (this.mode==3) { for ( this.j = 0; this.j < this.speed; this.j++ ) { if (this.distance_fly_max > 1) { if ( !(this.distance_fly==1 && onwall(this.hook[0]-(vecx(playerdir)*2),this.hook[1]-(vecy(playerdir)*2))) ) { playerx+=vecx(playerdir); playery+=vecy(playerdir); } } this.distance_fly--; hideimg 10+this.distance_fly_max-this.distance_fly; if (this.distance_fly<=0) { this.mode=0; this.j=this.speed; } } freezeplayer 0.05; timeout=0.05; } else if (this.mode==0) { CreateInitialValues(); hideimgs 10,10+this.distance_fly_max+1; setani idle,; } } function DrawHookshot() { if ( this.draw_fix != 0 ) this.draw_fix=this.distance_fly; for ( this.d=0; this.d<=this.draw_fix; this.d++ ) { if ( this.draw_fix == 0 ) this.d = this.distance_fly; if (this.d > 0) { showimg 10+this.d,rha_hookshot_sprites.png, playerx+1+vecx(playerdir)+(vecx(playerdir)*this.d), playery+1.5+(vecy(playerdir)*0.75)+(vecy(playerdir)*this.d); changeimgpart 10+this.d,abs(vecx(playerdir)*16),16,16,16; if ( this.d <= 1 && playerdir == 0 ) changeimgvis 10+this.d,0; } } this.draw_fix=0; this.hook={ playerx+1+vecx(playerdir)+(vecx(playerdir)*(this.distance_fly+1)), playery+1.5+(vecy(playerdir)*0.75)+(vecy(playerdir)*(this.distance_fly+1)) }; showimg 10+this.distance_fly_max+1,rha_hookshot_sprites.png, this.hook[0], this.hook[1]; changeimgpart 10+this.distance_fly_max+1,playerdir*16,32,16,16; } function CheckHit() { if ( this.mode == 1 ) { if ( onwall( int(this.hook[0]+0.5+(vecx(playerdir)/2)),int(this.hook[1]+0.5+(vecy(playerdir)/2)) ) ) { this.tile = tiles[int(this.hook[0]+0.5+(vecx(playerdir)/2)), int(this.hook[1]+0.5+(vecy(playerdir)/2))]; if ( this.tile in this.tiles_grab ) { if ( this.hook[0] in |0,64| && this.hook[1] in |0,64| ) { play crush.wav; this.distance_fly_max=this.distance_fly; this.mode=3; } } else if ( !(this.tile in this.tiles_pass) ) { play crush.wav; this.mode=2; } } } for ( this.i=1; this.i=0) { hitcompu this.hit_test_compu,strtofloat(#s(Hookshot_Level)),playerx,playery; this.mode = 2; } this.hit_test_item=0; while ( this.hit_test_item >= 0 ) { this.hit_test_item=testitem(this.hook[0]+0.5,this.hook[1]+0.5); if (this.hit_test_item in this.pull_items) { take2 this.hit_test_item; play extra.wav; UpdatePlayerItems(); this.draw_fix=1; this.hookshot_level = strtofloat(#s(Hookshot_Level)); if ( this.hookshot_level == 1 ) { this.hit_test_item = -1; this.mode = 2; } } } } function UpdatePlayerItems() { if ( rupees > 0 ) playerrupees += rupees; if ( darts > 0 ) playerdarts += darts; if ( bombs > 0 ) playerbombs += bombs; if ( hearts > 0 ) playerhearts += hearts; rupees = 0; darts = 0; bombs = 0; hearts = 0; } function CreateInitialValues() { this.speed=2; this.distance_fly=-1; this.hookshot_level = strtofloat(#s(Hookshot_Level)); this.distance_fly_max = 15; if ( this.hookshot_level > 1 ) { this.temp = this.hookshot_level; while ( this.temp > 1 ) { this.distance_fly_max += (15/this.temp); this.temp--; } this.distance_fly_max = int(this.distance_fly_max); } } SCRIPTEND