Advertisement
D0nyAlcap0ney

HM2 Tony Mask Code - For Tutorial

Oct 29th, 2024 (edited)
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Game Maker 10.79 KB | Source Code | 0 0
  1. ///TONY HM2 ABILITIES CODE. FOR TUTORIAL.
  2.  
  3. ///objPKillFat
  4.  
  5. //Create
  6.  
  7. image_speed=0.2
  8. ammo=0
  9. bled=0
  10.  
  11.  
  12. //Step
  13.  
  14. if image_index >= 5 and bled = 0 {
  15.     audio_play_sound(choose(sndPunch, sndPunch1, sndPunch2, sndPunch3), 0, false)
  16.     audio_play_sound(sndDoorHit, 0, false)
  17.     audio_play_sound(sndBonesBreak, 0, false)
  18.     global.shake = 18
  19.     my_id = instance_create(x + lengthdir_x(17, image_angle) - 1 + random(2), y + lengthdir_y(17, image_angle) - 1 + random(2), objBloodSquirt)
  20.     my_id = instance_create(x, y, objDeadBody)
  21.     my_id.sprite_index = sprEFatKneed
  22.     my_id.image_index = image_index
  23.     my_id.image_angle = image_angle
  24.     my_id.speed = 1.5
  25.     my_id.direction = image_angle
  26.     my_id.friction = 0.1
  27.     bled = 1
  28. }
  29.  
  30.  
  31. //Animation End
  32.  
  33. image_speed = 0
  34. image_index = 0
  35. if global.maskindex = 4 global.factor += 4
  36. myx = x + lengthdir_x(5, image_angle)
  37. myy = y + lengthdir_y(5, image_angle)
  38. my_id=instance_create(x,y-12,objScore)
  39. my_id.text="+"+string((1000)+400*(global.factor-1))+"pts"
  40. global.myscore += (1000) + 400 * (global.factor)
  41. global.killscore += 1000
  42. global.boldscore += 600 * global.factor
  43. global.combotime = 240
  44. global.combo += 1
  45. global.killx[global.kills] = x
  46. global.killy[global.kills] = y
  47. global.kills += 1
  48. ds_list_add(global.bonuslist, "Execution")
  49. if global.combotime < 12 global.combotime = 12
  50.  
  51.  
  52. instance_create(x + lengthdir_x(24, image_angle), y + lengthdir_y(24, image_angle), objBloodPool)
  53. my_id = instance_create(x, y, objPlayerMouse)
  54. my_id.reload = 5
  55.  
  56. instance_destroy()
  57.  
  58.  
  59. //Draw
  60.  
  61. if image_index<=5 draw_sprite_ext(sprEFatDieKneed,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha)
  62. draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha)
  63.  
  64.  
  65. ///objFatKnockedOut - Has a depth of 1. Has objKnockedOut as a parent.
  66.  
  67. //Create
  68.  
  69. image_speed=0
  70. friction=0.15
  71. alarm[0]=120+random(100)
  72. image_index = 1
  73. startx=x
  74. starty=y
  75. hits=0
  76. energie = 5
  77. shot=0
  78.  
  79.  
  80. //Alarm 0
  81.  
  82. image_speed = 0.25
  83.  
  84.  
  85. //Step
  86.  
  87. if image_speed > 0 exit
  88. scrMoveSolidOn()
  89. if !place_free(x, y) {
  90.     if speed > 0 {
  91.         move_outside_solid(direction - 180, 8)
  92.     } else {
  93.         if place_free(x + lengthdir_x(7, direction - 180), y + lengthdir_y(7, direction - 180)) {
  94.             dir = direction
  95.             if sprite_index = sprEGetUp sprite_index = sprEGetUpLean
  96.             if sprite_index = sprPoliceGetUp sprite_index = sprPoliceGetUpLean
  97.             direction = round(direction * (1 / 90)) * 90
  98.             image_angle = direction - 180
  99.             if place_free(x + lengthdir_x(5, direction), y + lengthdir_y(5, direction)) {
  100.                 direction = dir
  101.                 if sprite_index = sprEGetUpLean sprite_index = sprEGetUp
  102.                 if sprite_index = sprPoliceGetUpLean sprite_index = sprPoliceGetUp
  103.             }
  104.         }
  105.     }
  106.     speed = 0
  107. } else {
  108.     if !place_free(x + lengthdir_x(5, direction), y + lengthdir_y(5, direction)) {
  109.         move_contact_solid(direction, 8)
  110.         dir = direction
  111.         if sprite_index = sprEGetUp sprite_index = sprEGetUpLean
  112.         if sprite_index = sprPoliceGetUp sprite_index = sprPoliceGetUpLean
  113.         direction = round(direction * (1 / 90)) * 90
  114.         image_angle = direction - 180
  115.         if place_free(x + lengthdir_x(5, direction), y + lengthdir_y(5, direction)) {
  116.             direction = dir
  117.             if sprite_index = sprEGetUpLean sprite_index = sprEGetUp
  118.             if sprite_index = sprPoliceGetUpLean sprite_index = sprPoliceGetUp
  119.         }
  120.     }
  121. }
  122. scrMoveSolidOff()
  123.  
  124.  
  125. //Collision event with objBullet
  126.  
  127. image_xscale = 3
  128. image_yscale = 3
  129. global.my_id = id
  130. bullets = 0
  131. energie -= 1
  132. with objBullet {
  133.     if place_meeting(x, y, global.my_id) {
  134.         global.my_id.bullets += 1
  135.         my_id = instance_create(x, y, objSmokeHit)
  136.         my_id.image_angle = image_angle
  137.         my_id.direction = image_angle
  138.         my_id.speed = random(1)
  139.         my_id.image_blend = merge_color(c_red, c_maroon, 0.7)
  140.         instance_destroy()
  141.         alert = 1
  142.     }
  143. }
  144.  
  145. if energie == 0 shot = 1
  146. image_xscale = 1
  147. image_yscale = 1
  148.  
  149. //Shot to death.
  150. if shot == 1 {
  151. my_id=instance_create(x,y-12,objScore)
  152. my_id.text="+"+string((500)+40*(global.factor-1))+"pts"
  153. global.myscore += (500) + 40 * (global.factor)
  154. global.killscore += 500
  155. global.boldscore += 600 * global.factor
  156. global.combotime = 240
  157. global.combo += 1
  158. global.killx[global.kills] = x
  159. global.killy[global.kills] = y
  160. global.kills += 1
  161.     bullets = 4
  162.     repeat(3) {
  163.     my_id = instance_create(x, y, objBloodSplat)
  164.     my_id.direction = image_angle - 20 + random(40)
  165.     my_id.speed = 2 + random(2)
  166.     my_id.image_angle = random(360)
  167. }
  168.  
  169.  
  170.  
  171. repeat(4) {
  172.     my_id = instance_create(x, y, objBloodDrop)
  173.     my_id.direction = image_angle - 20 + random(40)
  174.     my_id.speed = 3 + random(3)
  175.     my_id.image_angle = my_id.direction
  176. }
  177.  
  178. repeat(1) {
  179.     instance_create(x + lengthdir_x(image_xscale, image_angle), y + lengthdir_y(image_yscale, image_angle), objBloodPool)
  180. }
  181.  
  182. repeat(1) {
  183.  
  184.     my_id = instance_create(x, y, objDeadBody)
  185.     my_id.direction = direction - 180
  186.     my_id.speed = 0.5
  187.     my_id.sprite_index = sprEFatDead
  188.     if shot == 1 my_id.image_index = floor(random(2))
  189.     else my_id.image_index = 2 + floor(random(2))
  190.     my_id.image_angle = my_id.direction
  191.     instance_destroy()
  192.     exit
  193. }
  194. }
  195.  
  196.  
  197. //Animation End
  198.  
  199. if sprite_index = sprEFatGetUp {
  200.     my_id = instance_create(x, y, objEnemyFat)
  201.     my_id.sprite_index = sprEFatWalk
  202.     instance_destroy()
  203. }
  204.  
  205. my_id.angle=image_angle-180
  206. my_id.direction = image_angle
  207. my_id.risen = 1
  208. my_id.startx = startx
  209. my_id.starty = starty
  210.  
  211. with my_id {
  212.     scrMoveSolidOn()
  213.     if !place_free(x, y) {
  214.         x = startx
  215.         y = starty
  216.     }
  217.     scrMoveSolidOff()
  218. }
  219.  
  220.  
  221. //Draw
  222.  
  223. draw_sprite_ext(sprite_index,image_index,x+1,y+1,image_xscale,image_yscale,angle,c_black,0.5)
  224. draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,angle,image_blend,image_alpha)
  225.  
  226.  
  227. ///objPKillDog
  228.  
  229. //Create
  230.  
  231. targetindex=0
  232. index=0
  233. image_speed=0
  234. dead=0
  235. cobra=0
  236. left=1
  237. ammo = objPlayerMouse.ammo
  238.  
  239.  
  240. //Step
  241.  
  242. if image_index>=10 and dead=0 {
  243. audio_play_sound(sndPunch, 0, false)
  244. audio_play_sound(sndHit1, 0, false)
  245. global.shake=5
  246. repeat (2+random(1)) {
  247. my_id=instance_create(x+scrPosDirX(21,-3,image_angle)-1+random(2),y+scrPosDirY(21,-3,image_angle)-1+random(2),objBloodSquirt)
  248. my_id.image_angle=image_angle-120+random(240)
  249. }
  250. repeat (3) instance_create(x+scrPosDirX(21,-3,image_angle)-1+random(2),y+scrPosDirY(21,-3,image_angle)-1+random(2),objBigBlood)
  251. my_id=instance_create(x,y-12,objScore) {
  252. my_id.text="+"+string((1500)+400*(global.factor-1))+"pts"
  253.     global.myscore += (1500) + 400 * (global.factor)
  254.     global.killscore += 1500
  255.     global.boldscore += 1000 * global.factor
  256.     global.combotime = 600
  257.     global.combo += 1
  258.     global.killx[global.kills] = x
  259.     global.killy[global.kills] = y
  260.     global.kills += 1
  261.     ds_list_add(global.bonuslist, "Execution")
  262.     if global.combotime < 12 global.combotime = 12
  263. dead=1
  264. }
  265. }
  266. if image_index<17 image_index+=0.3 else {
  267. my_id=instance_create(x+scrPosDirX(9,5,image_angle),y+scrPosDirY(9,5,image_angle),objDeadBody)
  268. my_id.sprite_index=sprDogDeadBlunt
  269. my_id.image_index=5
  270. my_id.image_angle=image_angle
  271. if sprite_index=sprPKillDog {my_id=instance_create(x,y,objPlayerMouse) my_id.sprite_index=sprPWalkUnarmed}
  272. instance_destroy()
  273. }
  274.  
  275.  
  276. //Animation End
  277.  
  278. image_speed=0
  279. image_index=0
  280.  
  281.  
  282. //Draw
  283.  
  284. if round(image_index)>=15 draw_sprite_ext(sprDogDeadBlunt,2,x+scrPosDirX(9,5,image_angle),y+scrPosDirY(9,5,image_angle),image_xscale,image_yscale,image_angle,image_blend,image_alpha)
  285. draw_sprite_ext(sprite_index,image_index,x+1,y+1,image_xscale,image_yscale,image_angle,c_black,0.5)
  286. draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha)
  287.  
  288.  
  289. ///scrPosDirX
  290.  
  291. return lengthdir_x(point_distance(0,0,argument0,argument1),point_direction(0,0,argument0,argument1)+argument2)
  292.  
  293. ///scrPosDirY
  294.  
  295. return lengthdir_y(point_distance(0,0,argument0,argument1),point_direction(0,0,argument0,argument1)+argument2)
  296.  
  297.  
  298. ///Code that allows Tony to knock out fats - Add to step event of objPlayerMouse
  299.  
  300. with objEnemy {
  301. if place_meeting(x,y,objPlayer) or place_meeting(x+global.spacex,y+global.spacey,objPlayer) {
  302. mask_index=sprWeaponMask
  303. if object_index = objEnemyFat and global.maskindex = 2 {
  304. edir = point_direction(objPlayer.lastx, objPlayer.lasty, x, y)
  305. audio_play_sound(sndDoorHit, 0, false)
  306. global.shake = 3
  307. my_id = instance_create(x, y, objFatKnockedOut)
  308. my_id.direction = edir - 10 + random(20)
  309. my_id.angle = my_id.direction
  310. with my_id move_outside_solid(angle - 180, 16)
  311. my_id.speed = 2
  312. instance_destroy()
  313. } else if scrCollisionLineExt(x,y,objPlayer.lastx,objPlayer.lasty,4,objSolid,objDoorV,objWallSoftH) or object_index=objEnemyFat or object_index=objInspector nothing=1 else {
  314. mask_index=sprMask
  315. global.shake=7
  316. my_id=instance_create(x,y-12,objScore)
  317. if object_get_parent(object_index)=objEnemyIdle {
  318. if room=rmTrainstationEntrance sprite_index=sprEWalkKnife else sprite_index=choose(sprEWalkShotgun,sprEWalkM16)
  319. }
  320.  
  321.  
  322. ///Code that allows fats to be executed - Add to scrKillShield
  323.  
  324. //Execute bouncers.
  325. if place_meeting(x, y, objFatKnockedOut) and global.exposed = 0 and global.maskindex = 2 {
  326.     with objFatKnockedOut {
  327.         image_xscale = 3
  328.         image_yscale = 3
  329.         if place_meeting(x, y, objPlayer) and global.test = 0 {
  330.             global.test = 2
  331.             my_id = instance_create(x, y, objPKillFat)
  332.             my_id.maskindex = global.maskindex
  333.             my_id.maskon = global.maskon
  334.             my_id.image_angle = angle
  335.             my_id.image_index = 1
  336.             instance_destroy()
  337.             instance_destroy(objPlayerMouse)
  338.         }
  339.     }
  340. }
  341.  
  342.  
  343.  
  344. ///Code that allows dogs to be executed - Add to step event of objPlayerMouse
  345.  
  346. if global.maskindex == 2 {
  347. if sprite_index == sprPAttackPunch {
  348. global.spacex=lengthdir_x(12,dir)
  349. global.spacey=lengthdir_y(12,dir)
  350. with objEnemy {
  351. if place_meeting(x,y,objPlayer) or place_meeting(x-global.spacex,y-global.spacey,objPlayer) {
  352. if object_index == objDogPatrol and (round(direction*(1/45))*45=round((objPlayer.dir-180)*(1/45))*45 or round(direction*(1/45))*45=round((objPlayer.dir+180)*(1/45))*45) {
  353. my_id=instance_create(objPlayer.x,objPlayer.y,objPKillDog)
  354. my_id.image_angle=objPlayer.dir
  355. my_id.ammo=ammo
  356. my_id.playerx=x
  357. my_id.playery=y
  358. with objPlayer {if object_index=objPlayerMouse instance_destroy()}
  359. instance_destroy()
  360. exit
  361. }
  362. }
  363. }
  364. }
  365. }
  366.  
  367.  
  368. //Code that prevents objDeadBody from changing image y_scale of sprDogDeadBlunt - Add to create event
  369.  
  370. if global.isdogexecution = true {
  371.     image_yscale = image_yscale
  372.     global.isdogexecution = false
  373.     }else{
  374.     image_yscale = -1 + round(random(1)) * 2
  375.     }
  376.  
  377.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement