Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.05 KB | None | 0 0
  1. //getting hit overrides just about every function of the player
  2. //most functionality is coded in the event that the player is not in the hit state
  3.  
  4. if(!isHit) {
  5.  
  6. //AIR
  7. if(!isGrounded) {
  8.  
  9. //BEHAVIOR
  10.  
  11. //SPRITE CHANGE determine sprite while in air
  12.  
  13. if(!isAttacking){
  14. //doubleJump takes priority
  15. if(!doubleJumpAnim) {
  16. if(jumpSpeed < jumpSpeedInit+1) { sprite_index = spr_wizard_jumpInit; }
  17. else if(jumpSpeed < -1) { sprite_index = spr_wizard_jumpUp; }
  18. else if (jumpSpeed < 0) { sprite_index = spr_wizard_jumpTop; }
  19. else if (jumpSpeed < jumpSpeedMAX/2) { sprite_index = spr_wizard_jumpDown; image_speed = 0;}
  20. else { sprite_index = spr_wizard_jumpDown; image_speed = runImageSpeed;}
  21. }
  22. else {
  23. if(image_index > 1.7) {
  24. doubleJumpAnim = false;
  25. }
  26. }
  27. }
  28. //attacking animation
  29. else {
  30. scr_wizard_standAttack();
  31. }
  32.  
  33. //Problem: GM has a bug when detecting collissions with image_xscale at -1
  34. //and a precise collision mask on the obj_wall_diag2 object
  35. //Solution: Temporarily put the image scale back to 1, do the math, and turn back.
  36. curr_xScale = image_xscale;
  37. image_xscale = 1;
  38.  
  39. //collide with wall above
  40. if(jumpSpeed <= 0 and place_meeting(x, y+jumpSpeed, obj_wall)) {
  41.  
  42. while(!place_meeting(x, y-1, obj_wall)){ y-=1; }
  43. jumpSpeed = 0;
  44. isCeilGrace = true;
  45. ceilGrace = 0;
  46.  
  47. }
  48.  
  49. //glide along ceiling grace period
  50. if(ceilGrace < ceilGraceMAX) {
  51. ceilGrace++;
  52. }
  53. else {
  54. ceilGrace = 0;
  55. isCeilGrace = false;
  56. }
  57.  
  58. //boost into specific 2 tile tall areas
  59. //if(place_meeting(x+curr_xScale, y, obj_wall) and place_meeting(x+curr_xScale, y+jumpSpeed, obj_wall)) {
  60. if(place_meeting(x+curr_xScale, y, obj_wall)) {
  61. //check an opening in the wall for each pixel for the current jump speed
  62. //start with i=1 because we already know that the wall is present for i=0
  63. //the +2 is because the character bounding box is 2 pixels short of 2 tiles (30 vs 32)
  64. var absJump = max(2,abs(jumpSpeed)+2);
  65. for(var i = 1; i < absJump; i++;) {
  66. //checking if the place is open and if the player is giving input in that direction
  67. if(!place_meeting(x+curr_xScale, y+(i*sign(jumpSpeed)), obj_wall) and
  68. place_meeting(x+curr_xScale, y+sign(jumpSpeed)+(i*sign(jumpSpeed)), obj_wall) and
  69. ((curr_xScale == -1 and leftCheck) or (curr_xScale == 1 and rightCheck))) {
  70.  
  71. x += curr_xScale;
  72. y += i*sign(jumpSpeed);
  73. while !place_meeting(x, y+1, obj_wall) {
  74. y += 1;
  75. }
  76. isGrounded = true;
  77. enterSecondAttack = false;
  78. enterThirdAttack = false;
  79. doubleJump = true;
  80. doubleJumpTimer = 0;
  81. jumpSpeed = 0;
  82. jumpSpeedH = 0;
  83. idleTimer = 0;
  84. if(duckCheck){
  85. isDucked = true;
  86. duckTimer = 0
  87. image_index = 0;
  88. image_speed = .2;
  89. }
  90. }
  91. }
  92. }
  93.  
  94.  
  95. //land the character if ground is below
  96. if(!isGrounded and place_meeting(x, y+jumpSpeed, obj_wall)) {
  97.  
  98. //resetting vars
  99. isGrounded = true;
  100.  
  101. enterSecondAttack = false;
  102. enterThirdAttack = false;
  103.  
  104. jsh = round(jumpSpeedH);
  105. if( place_meeting(x+jsh, y, obj_wall)) {
  106. jumpSpeedH = 0;
  107. //Move the player the remaining distance to the edge of the wall
  108. while(!place_meeting(x+sign(jsh), y, obj_wall)){ x+= sign(jsh); }
  109. }
  110. else {
  111. x += jsh;
  112.  
  113. }
  114.  
  115. //landing the character the remaining distance to the ground
  116. while !place_meeting(x, y+1, obj_wall) {
  117. y += 1;
  118. }
  119.  
  120. //hack to continue fluid movement when landing on upward slopes
  121. if(leftCheck and place_meeting(x+curr_xScale, y, obj_wall_diag2)) {
  122. x--;
  123. y--;
  124. }
  125. else if(rightCheck and place_meeting(x+curr_xScale, y, obj_wall_diag1)) {
  126. x++;
  127. y--;
  128. }
  129.  
  130. //determine if landing state should applied
  131. //jump is at near max speed downwards, is not in the middle of an attack combo, and is not wanting to move
  132. if(jumpSpeed > jumpSpeedMAX-1 and !isAttacking and !(leftCheck or rightCheck or duckCheck)) {
  133. isLanding = true;
  134. sprite_index = spr_wizard_jumpLand;
  135. image_index = 0;
  136. image_speed = .2;
  137. }
  138. if(duckCheck){
  139. isDucked = true;
  140. duckTimer = 0
  141. image_index = 0;
  142. image_speed = .2;
  143. }
  144. doubleJump = true;
  145. doubleJumpTimer = 0;
  146. jumpSpeed = 0;
  147.  
  148. idleTimer = 0;
  149. jumpGrace = 0;
  150.  
  151. if(isLandGrace and landGrace < landGraceMAX ) {
  152. scr_wizard_groundJump();
  153. }
  154. else {
  155. jumpSpeedH = 0;
  156. }
  157.  
  158. }
  159.  
  160. //continue falling
  161. if (!isGrounded and !isCeilGrace){
  162. //increase drop speed until it reaches maximum
  163. if(jumpSpeed < jumpSpeedMAX) {jumpSpeed += jumpAccel; }
  164. else { jumpSpeed = jumpSpeedMAX; }
  165.  
  166. y += floor(jumpSpeed);
  167. }
  168.  
  169. //move horizontal
  170. jsh = round(jumpSpeedH);
  171. if( place_meeting(x+jsh, y, obj_wall)) {
  172. jumpSpeedH = 0;
  173. //Move the player the remaining distance to the edge of the wall
  174. while(!place_meeting(x+sign(jsh), y, obj_wall)){ x+= sign(jsh); }
  175. }
  176. else {
  177.  
  178. x += jsh;
  179. }
  180.  
  181. ledgeTimer = 0;
  182.  
  183. //increment doublejump timer
  184. if(doubleJumpTimer < doubleJumpTimeLimit) {
  185. doubleJumpTimer++;
  186. }
  187.  
  188. image_xscale = curr_xScale;
  189.  
  190. //CONTROLS
  191. //left and right in air
  192.  
  193. if(!place_meeting(x+jsh,y,obj_wall) and leftCheck and !rightCheck and jumpSpeedH > -walkSpeed) {
  194. //image_xscale = -1
  195. jumpSpeedH -= jumpMoveH;
  196.  
  197. }
  198. if(!place_meeting(x+jsh,y,obj_wall) and rightCheck and !leftCheck and jumpSpeedH < walkSpeed) {
  199. //image_xscale = 1
  200. jumpSpeedH += jumpMoveH;
  201. }
  202.  
  203. //jump grace period timer
  204. if(!isGrounded and jumpGrace < jumpGraceMAX) {
  205. jumpGrace++;
  206. }
  207. else if(isLandGrace and landGrace < landGraceMAX) {
  208. landGrace++;
  209. }
  210.  
  211. //jump grace
  212. if(jumpPressed and jumpGrace < jumpGraceMAX) {
  213. scr_wizard_groundJump();
  214. }
  215.  
  216. //doublejump
  217. else if(unlockDoubleJump and jumpPressed and doubleJumpTimer >= doubleJumpTimeLimit and doubleJump and !isAttacking and mana >= 4) {
  218. mana -= 4;
  219. jumpSpeed = jumpSpeedInit;
  220. doubleJump = false;
  221. doubleJumpAnim = true;
  222. image_speed = .2;
  223. image_index = 0;
  224. //SPRITE CHANGE double jump
  225. sprite_index = spr_wizard_doubleJump;
  226. instance_create(x-(6*image_xscale), y-1, obj_doubleJumpBlast);
  227. }
  228.  
  229. //pre landing jump grace
  230. else if (jumpPressed) {
  231. landGrace = 0;
  232. isLandGrace = true;
  233. }
  234.  
  235.  
  236. //control jump height by releasing space bar
  237. if(jumpSpeed < 0 and jumpReleased) {
  238. jumpSpeed = -1;
  239. doubleJumpTimer = doubleJumpTimeLimit;
  240. //isGrounded = false;
  241. }
  242.  
  243.  
  244. }
  245.  
  246.  
  247. //GROUND
  248. else {
  249. //BEHAVIOR
  250.  
  251. //detecting ground beneath (walking off ledges etc)
  252.  
  253. //Problem: GM has a bug when detecting collissions with image_xscale at -1
  254. //and a precise collision mask on the obj_wall_diag2 object
  255. //Solution: Temporarily put the image scale back to 1, do the math, and turn back.
  256. curr_xScale = image_xscale;
  257. image_xscale = 1;
  258.  
  259.  
  260. //player has moved into a spot without ground below
  261. if(!place_meeting(x,y+1,obj_wall)){
  262. //if the player is moving on a downward slope
  263. if(place_meeting(x,y+2,obj_wall_diag1) or place_meeting(x,y+2,obj_wall_diag2)) {
  264. y+=1;
  265. }
  266. //if the player is to start falling
  267. else {
  268. isGrounded = false;
  269. //isLanding = false;
  270. isBackDash = false;
  271. backDashTimer = 0;
  272. backDashSpeed = backDashSpeedMAX;
  273. isSliding = false;
  274. isAttacking = false;
  275. doubleJumpTimer = 0;
  276. sprite_index = spr_wizard_jumpTop;
  277. jumpGrace = 0;
  278. }
  279. }
  280.  
  281. image_xscale = curr_xScale; //end of hack
  282.  
  283. if(isBackDash) {
  284.  
  285. scr_movePlayerGround(-backDashSpeed*image_xscale);
  286.  
  287. if (sprite_index = spr_wizard_backDashInit and (image_index + image_speed) >= sprite_get_number(sprite_index)) {
  288. sprite_index = spr_wizard_backDash;
  289.  
  290. }
  291. if(backDashTimer < backDashTimerLimit) {
  292. backDashTimer++;
  293. if(backDashTimer > 2*backDashTimerLimit/3) {
  294. backDashSpeed -= backDashDecel;
  295. sprite_index = spr_wizard_backDashEnd;
  296. image_speed = .18;
  297. }
  298. if(backDashTimer mod 5 = 0) {
  299. instance_create(x,y,obj_dashShadow);
  300. }
  301. }
  302. else {
  303. isBackDash = false;
  304. backDashTimer = 0;
  305. backDashSpeed = backDashSpeedMAX;
  306. }
  307. }
  308.  
  309. //No movement left, right, or down (or both left and right at the same time)
  310. else if(!(leftCheck or rightCheck or duckCheck) or (leftCheck and rightCheck) or !inputEnabled) {
  311.  
  312. //next jump will be straight up unless more movement is entered
  313. jumpSpeedH = 0;
  314. ledgeTimer = 0;
  315. if(fullSpeedTimer > 0) {
  316. fullSpeedTimer--;
  317. }
  318. if(slideEnableTimer < slideEnableTimerMAX) slideEnableTimer = 0;
  319.  
  320. if(!isAttacking) {
  321.  
  322. //SLIDING time woot
  323. if(isSliding) {
  324.  
  325. sprite_index = spr_wizard_slide;
  326. image_speed = .25;
  327.  
  328. /*
  329. rss = round(slideSpeed);
  330. if(!place_meeting(x+(rss*image_xscale), y, obj_wall)) {
  331. x += rss * image_xscale;
  332. }
  333. */
  334. if(abs(slideSpeed) > slideDecel) slideSpeed -= slideDecel*sign(slideSpeed);
  335.  
  336. scr_movePlayerGround(slideSpeed);
  337.  
  338. if(image_index > 2.70 or place_meeting(x+(rss*image_xscale),y,obj_wall)) {
  339. isSliding = false;
  340. slideEnableTimer = 0;
  341. slideSpeed = runSpeed;
  342. }
  343.  
  344.  
  345. }
  346.  
  347. //not landing
  348. else if(!isLanding) {
  349. //SPRITE CHANGE standing
  350. //idle
  351. if(idleTimer > idleTimerLimit) {
  352. //SPRITE CHANGE idle
  353. sprite_index = spr_wizard_idle;
  354. image_speed = idleImageSpeed;
  355. }
  356. else {
  357. idleTimer++;
  358. sprite_index = spr_wizard_stand;
  359. }
  360. }
  361. //landing animation
  362. else {
  363. sprite_index = spr_wizard_jumpLand;
  364. if(image_index > 1.75) {
  365. isLanding = false;
  366. }
  367. }
  368. }
  369. //standing attacking animation
  370. else {
  371. scr_wizard_standAttack();
  372. }
  373. }
  374.  
  375. //CONTROLS
  376. //Spacebar: Jump
  377. if(jumpPressed & !(place_meeting(x, y+jumpSpeedInit, obj_wall)) and !isBackDash) {
  378. scr_wizard_groundJump();
  379. }
  380.  
  381. //backdesh: accessed by Q or E, whichever button represents the direction away from where the player is facing
  382. if(!isBackDash and ((leftDashPressed and image_xscale = 1) or (rightDashPressed and image_xscale = -1))) {
  383. isBackDash = true;
  384. isSliding = false;
  385. isAttacking = false;
  386. enterSecondAttack = false;
  387. enterThirdAttack = false;
  388. sprite_index = spr_wizard_backDashInit;
  389. image_index = 0;
  390. image_speed = .2;
  391.  
  392. instance_create(x,y,obj_backDashBlast);
  393. }
  394. else if((leftDashPressed and image_xscale = -1) or (rightDashPressed and image_xscale = 1)) {
  395. //forward dash
  396. }
  397.  
  398. //Down Key: Duck
  399. if(duckPressed and !isAttacking) {
  400. isDucked = true;
  401. isLanding = false;
  402. isSliding = false;
  403. enterSecondAttack = false;
  404. enterThirdAttack = false;
  405. image_index = 0;
  406. image_speed = .2;
  407.  
  408. }
  409.  
  410. //staying ducked
  411. if(duckCheck and !isBackDash) {
  412. isDucked = true;
  413. isLanding = false;
  414. isSliding = false;
  415. enterSecondAttack = false;
  416. enterThirdAttack = false;
  417. image_speed = .2;
  418. //attacking
  419. if(isAttacking) {
  420. //create first blast on attacking frame
  421. if(image_index >= 1 and image_index < 1.1) {
  422. scr_wizard_createBlast();
  423. }
  424. //end attack animation
  425. else if(image_index > 2.75 and image_index <= 3) {
  426. isAttacking = false;
  427. }
  428. }
  429.  
  430. //SPRITE CHANGING duck animations
  431. //ducking idle, intro animation and holding the main duck frame
  432. else {
  433. if(duckTimer < duckTimerLimit) {
  434. duckTimer++;
  435. sprite_index = spr_wizard_duckInit;
  436. }
  437. else {
  438. sprite_index = spr_wizard_duck;
  439. image_index = 0;
  440. }
  441. }
  442.  
  443. }
  444. //duckrelease
  445. if(duckReleased) {
  446. sprite_index = spr_wizard_duckRel;
  447. duckTimer = 0;
  448. idleTimer = 0;
  449. isAttacking = false;
  450. isDucked = false;
  451. }
  452.  
  453.  
  454. //Left Key: Move left
  455. if(inputEnabled and leftCheck and !rightCheck and !duckCheck and !isBackDash) {
  456.  
  457. //GM HACK, GETS SET BACK TO -1 BEFORE THE END
  458. if(!isAttacking) {
  459. image_xscale = -1;
  460. }
  461. //cancel any previous sliding in motion
  462. isSliding = false;
  463.  
  464. //running
  465.  
  466. scr_movePlayerGround(-runSpeed);
  467.  
  468. //running attack animation
  469. if(isAttacking) {
  470. if(image_index > currRunFrame + .75 and image_index < currRunFrame + 1) {
  471. sprite_index = spr_wizard_runAtk_pt2;
  472. image_index = floor(currRunFrame + 1);
  473. scr_wizard_createBlast();
  474. }
  475. else if(image_index > currRunFrame + 1.75 and image_index < currRunFrame + 2) {
  476. sprite_index = spr_wizard_runAtk_pt3;
  477. image_index = floor(currRunFrame + 2);
  478. }
  479. else if(image_index > currRunFrame + 2.75) {
  480. isAttacking = false;
  481. attackDelayTimer = 0;
  482. sprite_index = spr_wizard_run;
  483. if(image_index > 7) { image_index -= 7; }
  484. }
  485. }
  486. //normal run animation
  487. else {
  488. sprite_index = spr_wizard_run;
  489. image_speed = runImageSpeed;
  490. }
  491.  
  492. //timer for falling or running off ledges
  493. if(isGrounded and ledgeTimer < ledgeTimerMAX) {
  494. ledgeTimer++;
  495. }
  496.  
  497. //full speed timer increment
  498. if(fullSpeedTimer < fullSpeedTimerMAX) {
  499. fullSpeedTimer++;
  500. }
  501. isDucked = false;
  502. isLanding = false;
  503. idleTimer = 0;
  504. slideEnableTimer++;
  505. enterSecondAttack = false;
  506. enterThirdAttack = false;
  507. }
  508.  
  509.  
  510.  
  511. //Right Key: Move right
  512. else if(inputEnabled and rightCheck and !leftCheck and !duckCheck and !isBackDash) {
  513.  
  514. if(!isAttacking) {
  515. image_xscale = 1;
  516. }
  517. isSliding = false;
  518.  
  519. scr_movePlayerGround(runSpeed);
  520.  
  521. //SPRITE CHANGE run
  522. //running and attacking
  523.  
  524. if(isAttacking) {
  525. if(image_index > currRunFrame + .75 and image_index < currRunFrame + 1) {
  526. sprite_index = spr_wizard_runAtk_pt2;
  527. image_index = floor(currRunFrame + 1);
  528. scr_wizard_createBlast();
  529. }
  530. else if(image_index > currRunFrame + 1.75 and image_index < currRunFrame + 2) {
  531. sprite_index = spr_wizard_runAtk_pt3;
  532. image_index = floor(currRunFrame + 2);
  533. }
  534. else if(image_index > currRunFrame + 2.75) {
  535. isAttacking = false;
  536. attackDelayTimer = 0;
  537. sprite_index = spr_wizard_run;
  538. if(image_index > 7) { image_index -= 7; }
  539.  
  540. }
  541. }
  542. //normal run animation
  543. else {
  544. sprite_index = spr_wizard_run;
  545. image_speed = runImageSpeed;
  546. }
  547.  
  548. //timer for falling or running off ledges
  549. if(isGrounded and ledgeTimer < ledgeTimerMAX) {
  550. ledgeTimer++;
  551. }
  552. //full speed timer increment
  553. if(fullSpeedTimer < fullSpeedTimerMAX) {
  554. fullSpeedTimer++;
  555. }
  556. isDucked = false;
  557. isLanding = false;
  558. idleTimer = 0;
  559. slideEnableTimer++;
  560. enterSecondAttack = false;
  561. enterThirdAttack = false;
  562. }
  563.  
  564. //enable sliding
  565. if(leftReleased and !rightCheck and !duckCheck
  566. and !place_meeting(x-runSpeed, y, obj_wall) and slideEnableTimer > slideEnableTimerMAX) {
  567. isSliding = true;
  568. slideSpeed = -runSpeed;
  569. isLanding = false;
  570. isAttacking = false;
  571. }
  572. else if(rightReleased and !leftReleased and !duckCheck
  573. and !place_meeting(x+runSpeed, y, obj_wall) and slideEnableTimer > slideEnableTimerMAX) {
  574. isSliding = true;
  575. slideSpeed = runSpeed;
  576. isLanding = false;
  577. isAttacking = false;
  578. }
  579. }
  580.  
  581. //Code that executes regardless of jump condition
  582.  
  583. //BEHAVIOR
  584.  
  585. //mana regen
  586. if(manaRegenCounter < manaRegenLimit) {
  587. manaRegenCounter++;
  588. }
  589. else {
  590. if(mana < maxMana and (!isCharging or isFullyCharged)) {
  591. mana++;
  592. }
  593. manaRegenCounter = 0;
  594. }
  595.  
  596. //checking attack completion
  597.  
  598. //getting hit
  599. hitEnemy = instance_place(x,y,obj_enemy);
  600. if(!isInvincible and (place_meeting(x,y,obj_enemy) or place_meeting(x,y,obj_enemyBlast)) and hitEnemy != noone and hitEnemy.isDead == false) {
  601. isHit = true;
  602. isInvincible = true;
  603. isAttacking = false;
  604. isLanding = false;
  605. isSliding = false;
  606. isBackDash = false;
  607. backDashTimer = 0;
  608. backDashSpeed = backDashSpeedMAX;
  609. enterSecondAttack = false;
  610. enterThirdAttack = false;
  611. idleTimer = 0;
  612. jumpSpeedH = 0;
  613. jumpSpeed = 0;
  614. }
  615.  
  616. //keep things pixelized
  617. //this shouldnt even be necessary if all other code works correctly
  618. //x = round(x);
  619. //y = round(y);
  620.  
  621. //change elemental type
  622.  
  623.  
  624. //CONTROLS
  625.  
  626. //outside of jump, within hit
  627.  
  628. //attack
  629. if(inputEnabled and attackPressed and !isAttacking and !isBackDash and attackDelayTimer >= attackDelayLimit and mana >= blastCost) {
  630. idleTimer = 0;
  631. chargeStartTimer = 0;
  632. chargeTimer = 0;
  633. image_speed = .2
  634. //standing, walking, jumping, or ducking
  635.  
  636. if(isDucked) {
  637. sprite_index = spr_wizard_duckAtk;
  638. image_index = 0;
  639. image_speed = .2;
  640. }
  641. else if(isGrounded and (leftCheck or rightCheck)){
  642. currRunFrame = floor(image_index);
  643. sprite_index = spr_wizard_runAtk_pt1;
  644. image_index = currRunFrame;
  645. image_speed = .2
  646. }
  647. else {
  648. sprite_index = spr_wizard_standAtk;
  649. image_index = 0;
  650. image_speed = .2;
  651. }
  652.  
  653. isAttacking = true;
  654. isSliding = false;
  655. isLanding = false;
  656. }
  657. //queue up second attack
  658. else if(inputEnabled and attackPressed and !(isGrounded and (leftCheck or rightCheck)) and !isDucked and isAttacking and !isBackDash and !enterSecondAttack and !enterThirdAttack and mana >= blastCost) {
  659. enterSecondAttack = true;
  660. }
  661. //queue up third attack
  662. else if(inputEnabled and attackPressed and !(isGrounded and (leftCheck or rightCheck)) and !isDucked and isAttacking and !isBackDash and !enterThirdAttack and mana >= blastCost) {
  663. enterThirdAttack = true;
  664. }
  665.  
  666. //charging up blast
  667. if(inputEnabled and attackCheck) {
  668.  
  669. if(chargeStartTimer < chargeStartTimerLimit) {
  670. chargeStartTimer++;
  671. }
  672. else {
  673. if(!instance_exists(obj_chargingFX)) {
  674. chargingFX = instance_create(x+2,y-16,obj_chargingFX);
  675. }
  676. isCharging = true;
  677. chargeTimer++;
  678. //fully charged
  679. if(chargeTimer > chargeTimerLimit) {
  680. isFullyCharged = true;
  681. }
  682. //not fully charged yet
  683. else if (chargeTimer mod 8 == 0){
  684. mana -= 1;
  685. }
  686. }
  687. }
  688. //releasing charge blast
  689. if(attackReleased) {
  690. //remove charging animation
  691. if(isCharging) {
  692. with(chargingFX) instance_destroy();
  693.  
  694. if(!isBackDash) {
  695. isAttacking = true;
  696. isSliding = false;
  697. isLanding = false;
  698.  
  699.  
  700. if(isDucked) {
  701. sprite_index = spr_wizard_duckAtk;
  702. image_index = 0;
  703. image_speed = .2;
  704. }
  705. else if(isGrounded and (leftCheck or rightCheck)){
  706. currRunFrame = floor(image_index);
  707. sprite_index = spr_wizard_runAtk_pt1;
  708. image_index = currRunFrame;
  709. image_speed = .2
  710. }
  711. else {
  712. sprite_index = spr_wizard_standAtk;
  713. image_index = 0;
  714. image_speed = .2;
  715. }
  716. }
  717. else {
  718. scr_wizard_createBlast();
  719. }
  720.  
  721. chargeStartTimer = 0;
  722. chargeTimer = 0;
  723. }
  724. }
  725. }
  726.  
  727.  
  728. //OUTSIDE OF HIT
  729.  
  730.  
  731. //hit
  732. else{
  733. if(hitTimer < hitTimerLimit) {
  734. sprite_index = spr_wizard_hit;
  735.  
  736. hitMove = round(10-hitTimer)/5*-image_xscale;
  737. scr_movePlayerHit(hitMove);
  738. hitTimer++;
  739. }
  740. else {
  741. isHit = false;
  742. hitTimer = 0;
  743. }
  744. }
  745.  
  746. if(isInvincible and invincTimer < invincTimerLimit) {
  747. invincTimer++;
  748. }
  749. else {
  750. isInvincible = false;
  751. invincTimer = 0;
  752. }
  753.  
  754. //element changing from item
  755. if(isChangingElement) {
  756. if(elementChangeAlpha > 0)
  757. {
  758. elementChangeAlpha -= elementChangeAlphaDecay;
  759. }
  760. else {
  761. isChangingElement = false;
  762. }
  763. }
  764.  
  765. //increase attack delay timer (timer == limit means attack is usable)
  766. if(attackDelayTimer < attackDelayLimit) {
  767. attackDelayTimer++;
  768. }
  769. //restart room
  770. if(health <= 0 or restartPressed) {
  771. room_goto(room_RR_01);
  772. x=144;
  773. y=1712;
  774. }
  775.  
  776. scr_setCamera();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement