Advertisement
TJSJ

Pokemon Test

Feb 1st, 2019
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Information about object: Var
  2. Sprite:
  3. Solid: false
  4. Visible: true
  5. Depth: 0
  6. Persistent: false
  7. Parent:
  8. Children:
  9. Mask:
  10.  
  11. No Physics Object
  12. Create Event:
  13.  
  14. execute code:
  15.  
  16. ///GENERATE POKEMON VARIABLES
  17.  
  18. MonAmount = 4;
  19.  
  20. for( i=0; i<MonAmount; i++ ) //generate our MON IDs
  21. {
  22. //generate the database for our mons so we retrieve these values
  23. //when battling and store them in the player values.
  24. //these will need to be edited manually
  25. Id[i] = i;
  26. NameId[i] = "";
  27. HlthId[i] = 0;
  28. AttkId[i] = 0;
  29. DfnsId[i] = 0;
  30. SpedId[i] = 0;
  31. }
  32.  
  33. for( p=0; p<2; p++ ) //generate our player mon objects
  34. {
  35. //there will be a pair of these variable
  36. //Plyr[0] being the client player
  37. //Plyr[1] being the opposing player
  38. PlyrName[p] = "";
  39. PlyrHlth[p] = 0;
  40. PlyrAttk[p] = 0;
  41. PlyrDfns[p] = 0;
  42. PlyrSped[p] = 0;
  43. }
  44.  
  45.  
  46.  
  47. execute code:
  48.  
  49. ///MOVE STATS
  50.  
  51. Moves = 10;
  52.  
  53. for ( i=0; i<Moves; i++ ) {
  54. MovePower[i] = 1;
  55. MoveName[i] = "Move Name";
  56. }
  57.  
  58. MoveName[0] = "Tackle";
  59. MovePower[0] = 40;
  60.  
  61. MoveName[1] = "Dorito Slap";
  62. MovePower[1] = 60;
  63.  
  64. MoveName[2] = "Donut Pounce";
  65. MovePower[2] = 60;
  66.  
  67. MoveName[3] = "Cinnamon Dust";
  68. MovePower[3] = 60;
  69.  
  70. MoveName[4] = "Ice Beam";
  71. MovePower[4] = 90;
  72.  
  73. MoveName[5] = "Water Gun";
  74. MovePower[5] = 60;
  75.  
  76. MoveName[6] = "Sparkle Ray";
  77. MovePower[6] = 90;
  78.  
  79. MoveName[7] = "Flamethrower";
  80. MovePower[7] = 90;
  81.  
  82. MoveName[8] = "Energy Ball";
  83. MovePower[8] = 90;
  84.  
  85. MoveName[9] = "Shadow Ball";
  86. MovePower[9] = 90;
  87.  
  88. MoveName[10] = "Big Kick";
  89. MovePower[10] = 120;
  90.  
  91. execute code:
  92.  
  93. ///POKEMON STAT CONSTANTS, DO NOT REFERENCE DIRECTLY!!!
  94.  
  95. /* TEMPLATE
  96. NameId[0] = "";
  97. HlthId[0] = 0;
  98. AttkId[0] = 0;
  99. DfnsId[0] = 0;
  100. SpedId[0] = 0;
  101. */
  102.  
  103. /*
  104. THESE ARE CONSTANTS, THEREFORE THESE
  105. WONT BE REFERENCED DIRECTLY!!!
  106. WE USE THE PlyrId VARIABLES INSTEAD!!!
  107. */
  108.  
  109. NameId[0] = "Dorito";
  110. HlthId[0] = 90;      
  111. AttkId[0] = 120;    
  112. DfnsId[0] = 100;    
  113. SpedId[0] = 80;      
  114.  
  115. NameId[1] = "Cinnamon Bun";
  116. HlthId[1] = 100;      
  117. AttkId[1] = 110;    
  118. DfnsId[1] = 120;      
  119. SpedId[1] = 53;    
  120.  
  121. NameId[2] = "Glazed Donut";
  122. HlthId[2] = 110;    
  123. AttkId[2] = 93;      
  124. DfnsId[2] = 80;      
  125. SpedId[2] = 144;      
  126.  
  127. NameId[3] = "Pizza";
  128. HlthId[3] = 130;    
  129. AttkId[3] = 130;      
  130. DfnsId[3] = 90;      
  131. SpedId[3] = 20;      
  132.  
  133. Step Event:
  134.  
  135. execute code:
  136.  
  137. ///STORING VALUES
  138.  
  139. /* store ids of mons so they are specifically
  140. choosen in battle, where 'm' represents
  141. the id of the mon and 'p' represents which mon
  142. you are in control of */
  143.  
  144. /* m = mon id */
  145. /* p = player number (0 or 1) */
  146.  
  147. /*
  148.  
  149. if update = true {
  150.  
  151. with(Mon) {
  152.     switch(o) {
  153.     // check if o = control player "0" or opposing player "1"
  154.         case 0:
  155.             aStoredPlyrName[m,o] = Var.PlyrName[o]
  156.             aStoredPlyrHlth[m,o] = Var.PlyrHlth[o]
  157.             aStoredPlyrAttk[m,o] = Var.PlyrAttk[o]
  158.             aStoredPlyrDfns[m,o] = Var.PlyrDfns[o]
  159.             aStoredPlyrSped[m,o] = Var.PlyrSped[o]
  160.             break;
  161.         case 1:
  162.             bStoredPlyrName[m,o] = Var.PlyrName[o]
  163.             bStoredPlyrHlth[m,o] = Var.PlyrHlth[o]
  164.             bStoredPlyrAttk[m,o] = Var.PlyrAttk[o]
  165.             bStoredPlyrDfns[m,o] = Var.PlyrDfns[o]
  166.             bStoredPlyrSped[m,o] = Var.PlyrSped[o]
  167.             break;
  168.     }
  169. }
  170. update = false;
  171. }
  172.  
  173. // change Var.update to true whenever mon is changed
  174.  
  175. Information about object: Mon
  176. Sprite:
  177. Solid: false
  178. Visible: true
  179. Depth: 0
  180. Persistent: false
  181. Parent:
  182. Children:
  183. Mask:
  184.  
  185. No Physics Object
  186. Create Event:
  187.  
  188. execute code:
  189.  
  190. ///CREATE PLAYER ID
  191.  
  192. o = 0; // 0 is the controlling player, 1 is the opposing player !!!
  193.  
  194. CurrentPartyMember = 1;
  195.  
  196. c = CurrentPartyMember;
  197.  
  198. m = irandom_range(0,Var.MonAmount); // which pokemon are we? (note: this is changed in BattleDummy)
  199.  
  200. DamageInflicted = 0;
  201. Waiting[0] = -1;
  202. Waiting[1] = -1;
  203. Waiting[0] = false;
  204. Waiting[1] = false;
  205. aDamageInflicted = 0;
  206. bDamageInflicted = 0;
  207. Plyr[o] = true;
  208. StoredText[0] = "text";
  209. StoredText[1] = "text";
  210. StoredText[o] = "sample text";
  211. StoredPower1 = 0;
  212. StoredPower2 = 0;
  213. Health[o] = 0;
  214. PlyrName[0] = "";
  215. PlyrHlth[0] = 0;
  216. PlyrAttk[0] = 0;
  217. PlyrDfns[0] = 0;
  218. PlyrSped[0] = 0;
  219. PlyrName[1] = "";
  220. PlyrHlth[1] = 0;
  221. PlyrAttk[1] = 0;
  222. PlyrDfns[1] = 0;
  223. PlyrSped[1] = 0;
  224. PlyrName[o] = "";
  225. PlyrHlth[o] = 0;
  226. PlyrAttk[o] = 0;
  227. PlyrDfns[o] = 0;
  228. //PlyrSped[o] = 0;
  229. aPlyrMove1 = 0;
  230. aPlyrMove2 = 0;
  231. aPlyrMove3 = 0;
  232. aPlyrMove4 = 0;
  233. bPlyrMove1 = 0;
  234. bPlyrMove2 = 0;
  235. bPlyrMove3 = 0;
  236. bPlyrMove4 = 0;
  237. MoveSelected = false;
  238. Waiting[o] = false; // are we done selecting a move?
  239. Moving[o] = false;
  240. IsDamaged[0] = false;
  241. IsDamaged[1] = false;
  242. PartyTotal[o] = 4; // default value, this is changed in BattleDummy
  243. Move[0] = 0;
  244. Move[1] = 1;
  245. Move[2] = 2;
  246. Move[3] = 3;
  247. aMoveSelected = false;
  248. bMoveSelected = false;
  249.  
  250. for ( n=0; n<PartyTotal[o]; n++ ) {
  251.    
  252.     // PLAYER ONE
  253.     aStoredPlyrName[m,n] = "";
  254.     aStoredPlyrHlth[m,n] = 0;
  255.     aStoredPlyrHlthCache[m,n] = 0;
  256.     aStoredPlyrAttk[m,n] = 0;
  257.     aStoredPlyrDfns[m,n] = 0;
  258.     aStoredPlyrSped[m,n] = 0;
  259.     aStoredPlyrMove1[m,n] = irandom_range(0,Var.Moves);
  260.     aStoredPlyrMove2[m,n] = irandom_range(0,Var.Moves);
  261.     aStoredPlyrMove3[m,n] = irandom_range(0,Var.Moves);
  262.     aStoredPlyrMove4[m,n] = irandom_range(0,Var.Moves);
  263.    
  264.     // PLAYER TWO
  265.     bStoredPlyrName[m,n] = "";
  266.     bStoredPlyrHlth[m,n] = 0;
  267.     bStoredPlyrHlthCache[m,n] = 0;
  268.     bStoredPlyrAttk[m,n] = 0;
  269.     bStoredPlyrDfns[m,n] = 0;
  270.     bStoredPlyrSped[m,n] = 0;
  271.     bStoredPlyrMove1[m,n] = irandom_range(0,Var.Moves);
  272.     bStoredPlyrMove2[m,n] = irandom_range(0,Var.Moves);
  273.     bStoredPlyrMove3[m,n] = irandom_range(0,Var.Moves);
  274.     bStoredPlyrMove4[m,n] = irandom_range(0,Var.Moves);
  275.     }
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289. /*
  290. If ((Player[a].Health > (Player[a].Health - Player[b].DamageInflicted))
  291. && Player[a].IsDamaged = true) {
  292.     Player[a].Health -= 1/128 //lose health at 1/128 rate if damaged by opponent.
  293. }
  294.  
  295. 100 > (100 - 50)
  296.       which is 50
  297.       */
  298.  
  299. execute code:
  300.  
  301. ///MOVE STATS
  302.  
  303. Moves = 10;
  304.  
  305. for ( i=0; i<Moves; i++ ) {
  306. MovePower[i] = 1;
  307. MoveName[i] = "Move Name";
  308. }
  309.  
  310. MoveName[0] = "Tackle";
  311. MovePower[0] = 40;
  312.  
  313. MoveName[1] = "Dorito Slap";
  314. MovePower[1] = 60;
  315.  
  316. MoveName[2] = "Donut Pounce";
  317. MovePower[2] = 60;
  318.  
  319. MoveName[3] = "Cinnamon Dust";
  320. MovePower[3] = 60;
  321.  
  322. MoveName[4] = "Ice Beam";
  323. MovePower[4] = 90;
  324.  
  325. MoveName[5] = "Water Gun";
  326. MovePower[5] = 60;
  327.  
  328. MoveName[6] = "Sparkle Ray";
  329. MovePower[6] = 90;
  330.  
  331. MoveName[7] = "Flamethrower";
  332. MovePower[7] = 90;
  333.  
  334. MoveName[8] = "Energy Ball";
  335. MovePower[8] = 90;
  336.  
  337. MoveName[9] = "Shadow Ball";
  338. MovePower[9] = 90;
  339.  
  340. MoveName[10] = "Big Kick";
  341. MovePower[10] = 120;
  342.  
  343. Step Event:
  344.  
  345. execute code:
  346.  
  347. if o = 0
  348. {
  349. Position = "back";
  350. sprite_index = spr_mon_back;
  351. image_xscale = 2;
  352. image_yscale = 2;
  353. image_speed = 0;
  354. image_index = m;
  355. x = view_xview + view_wview*0.2;
  356. y = view_yview + view_hview*0.6;
  357. global.aStoredPlyrName = aStoredPlyrName[m,c]
  358. global.aStoredPlyrHlth = aStoredPlyrHlth[m,c]
  359. global.aStoredPlyrAttk = aStoredPlyrAttk[m,c]
  360. global.aStoredPlyrDfns = aStoredPlyrDfns[m,c]
  361. global.aStoredPlyrSped = aStoredPlyrSped[m,c]
  362. }
  363.  
  364. if o = 1
  365. {
  366. Position = "front";
  367. sprite_index = spr_mon_front;
  368. image_xscale = 2;
  369. image_yscale = 2;
  370. image_speed = 0;
  371. image_index = m;
  372. x = view_xview + view_wview*0.8;
  373. y = view_yview + view_hview*0.4;
  374. global.bStoredPlyrName = bStoredPlyrName[m,c]
  375. global.bStoredPlyrHlth = bStoredPlyrHlth[m,c]
  376. global.bStoredPlyrAttk = bStoredPlyrAttk[m,c]
  377. global.bStoredPlyrDfns = bStoredPlyrDfns[m,c]
  378. global.bStoredPlyrSped = bStoredPlyrSped[m,c]
  379. }
  380.  
  381.  
  382. // if we are damaged at all...
  383.  
  384. if (o = 0 && global.Player1Damaged = true) {
  385.     if (global.aHealth > (aStoredPlyrHlthCache[m,c] - global.bDamageInflicted)) {
  386.         global.aHealth -= 1/4; //lose health at 1/128 rate if damaged
  387.     }
  388.  
  389.     if (global.aHealth <= (aStoredPlyrHlthCache[m,c] - global.bDamageInflicted)) {
  390.         global.Player1Moving = false;
  391.         global.Player1DoneMoving = true;
  392.         global.Player1Damaged = false;
  393.     }
  394. }
  395.  
  396. if (o = 1 && global.Player2Damaged = true) {
  397.     if (global.bHealth > (bStoredPlyrHlthCache[m,c] - global.aDamageInflicted)) {
  398.         global.bHealth -= 1/4; //lose health at 1/128 rate if damaged
  399.     }
  400.  
  401.     if (global.bHealth <= (bStoredPlyrHlthCache[m,c] - global.aDamageInflicted)) {
  402.         global.Player2Moving = false;
  403.         global.Player2DoneMoving = true;
  404.         global.Player2Damaged = false;
  405.     }
  406. }
  407.  
  408. if (o = 0 && global.Player1Damaged = false) {
  409.     aStoredPlyrHlthCache[m,c] = global.aHealth;
  410. }
  411.  
  412. if (o = 1 && global.Player2Damaged = false) {
  413.     bStoredPlyrHlthCache[m,c] = global.bHealth;
  414. }
  415.  
  416.  
  417.  
  418. Draw Event:
  419.  
  420. execute code:
  421.  
  422. x1 = x-64*2*1.2;
  423. y1 = y-64*2*1.4;
  424. x2 = x+64*2*1.2;
  425. y2 = y-64*2*1.2;
  426.  
  427. xdiff = x2-x1
  428.  
  429. draw_sprite(sprite_index,image_index,x,y);
  430. draw_set_font(font0);
  431. draw_set_color(c_teal);
  432. draw_rectangle(x1,y1,x2,y2,false);
  433. draw_set_color(c_yellow);
  434. //text_draw(x1,y1-100,"Error: "+string(bStoredPlyrSped[m,c]),c_black);
  435. if o = 0 {
  436.     draw_rectangle(x1,y1,x2*global.aHealth/aStoredPlyrHlth[m,c],y2,false)
  437.     text_draw(x1,y1-24,PlyrName[0],c_white);
  438.     text_draw(x1,y1+14*2/1.25,"HP: "+string(global.aHealth)+"/"+string(aStoredPlyrHlth[m,c]),c_white);
  439.     text_draw(x1,y1+39,"aPlyrHlthCache: "+string(aStoredPlyrHlthCache[m,c]),c_black);
  440. }
  441. if o = 1 {
  442.     draw_rectangle(x1,y1,x2*global.bHealth/bStoredPlyrHlth[m,c],y2,false)
  443.     text_draw(x1,y1-24,PlyrName[1],c_white);
  444.     text_draw(x1,y1+14*2/1.25,"HP: "+string(global.bHealth)+"/"+string(bStoredPlyrHlth[m,c]),c_white);
  445.     text_draw(x1,y1+39,"bPlyrHlthCache: "+string(bStoredPlyrHlthCache[m,c]),c_black);
  446. }
  447.  
  448. Information about object: BattleDummy
  449. Sprite:
  450. Solid: false
  451. Visible: true
  452. Depth: 0
  453. Persistent: false
  454. Parent:
  455. Children:
  456. Mask:
  457.  
  458. No Physics Object
  459. Create Event:
  460.  
  461. execute code:
  462.  
  463. /// FETCH VALUES FOR POKEMON ON THE FIELD
  464. // Var object holds all the constants
  465.  
  466. // IMPORTANT vvvvvvvvvv
  467.  
  468. // m = mon id;
  469. // c = position in party;
  470.  
  471. // IMPORTANT ^^^^^^^^^^
  472.  
  473. debugger = false;
  474. message_text = "";
  475. instance_create(x,y,Var);
  476. global.PlayerQueue = 0;
  477. global.FinishedTurn = true;
  478. global.Player1Moving = false;
  479. global.Player2Moving = false;
  480. global.Player1DoneMoving = true;
  481. global.Player2DoneMoving = true;
  482. global.Player1Damaged = false;
  483. global.Player2Damaged = false;
  484. global.aHealth = 90;
  485. global.bHealth = 90;
  486. global.aDamageInflicted = 0;
  487. global.bDamageInflicted = 0;
  488. SelectedMove = 0;
  489. OtherSelectedMove = 0;
  490. aSideName = "";
  491. bSideName = "";
  492. delay = 0;
  493. PreAttackDelay = 1;
  494. PostAttackDelay = 1;
  495.  
  496. /* PLAYER 1 MON ------------------------- */
  497.  
  498. with(instance_create(x,y,Mon)) { /* PLAYER 1 MON ------------------------- */
  499.  
  500. o = 0; // set mon to be player 1
  501.  
  502. m = irandom_range(0,3); // for now we randomly select a mon
  503.  
  504. image_index = m; //update sprite to appropriate mon
  505.  
  506. // then we grab the corresponding stats for that mon
  507. aStoredPlyrName[m,c] = Var.NameId[m];
  508. aStoredPlyrHlth[m,c] = Var.HlthId[m];
  509. aStoredPlyrHlthCache[m,c] = Var.HlthId[m];
  510. aStoredPlyrAttk[m,c] = Var.AttkId[m];
  511. aStoredPlyrDfns[m,c] = Var.DfnsId[m];
  512. aStoredPlyrSped[m,c] = Var.SpedId[m];
  513. aStoredPlyrMove1[m,c] = irandom_range(0,Var.Moves);
  514. aStoredPlyrMove2[m,c] = irandom_range(0,Var.Moves);
  515. aStoredPlyrMove3[m,c] = irandom_range(0,Var.Moves);
  516. aStoredPlyrMove4[m,c] = irandom_range(0,Var.Moves);
  517.  
  518. // now we set our local stat variables to equal the stored data
  519. // PlyrName[0] = aStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of your party
  520.  
  521. global.aHealth = aStoredPlyrHlth[m,c];
  522. PlyrName[o] = aStoredPlyrName[m,c];
  523. PlyrHlth[o] = aStoredPlyrHlth[m,c];
  524. PlyrAttk[o] = aStoredPlyrAttk[m,c];
  525. PlyrDfns[o] = aStoredPlyrDfns[m,c];
  526. PlyrSped[0] = aStoredPlyrSped[m,c];
  527. aPlyrMove1 = aStoredPlyrMove1[m,c];
  528. aPlyrMove2 = aStoredPlyrMove2[m,c];
  529. aPlyrMove3 = aStoredPlyrMove3[m,c];
  530. aPlyrMove4 = aStoredPlyrMove4[m,c];
  531. }
  532.  
  533. /* PLAYER 2 MON ------------------------- */
  534.  
  535. with(instance_create(x,y,Mon)) { /* PLAYER 2 MON ------------------------- */
  536.  
  537. o = 1; // set mon to be player 2
  538.  
  539. m = irandom_range(0,3); // for now we randomly select a mon
  540.  
  541. image_index = m; //update sprite to appropriate mon
  542.  
  543. // then we grab the corresponding stats for that mon
  544. bStoredPlyrName[m,c] = Var.NameId[m];
  545. bStoredPlyrHlth[m,c] = Var.HlthId[m];
  546. bStoredPlyrHlthCache[m,c] = Var.HlthId[m];
  547. bStoredPlyrAttk[m,c] = Var.AttkId[m];
  548. bStoredPlyrDfns[m,c] = Var.DfnsId[m];
  549. bStoredPlyrSped[m,c] = Var.SpedId[m];
  550. bStoredPlyrMove1[m,c] = irandom_range(0,Var.Moves);
  551. bStoredPlyrMove2[m,c] = irandom_range(0,Var.Moves);
  552. bStoredPlyrMove3[m,c] = irandom_range(0,Var.Moves);
  553. bStoredPlyrMove4[m,c] = irandom_range(0,Var.Moves);
  554.  
  555. // now we set our local stat variables to equal the stored data
  556. //PlyrName[1] = bStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of opponents party
  557.  
  558. global.bHealth = bStoredPlyrHlth[m,c];
  559. PlyrName[o] = bStoredPlyrName[m,c];
  560. PlyrHlth[o] = bStoredPlyrHlth[m,c];
  561. PlyrAttk[o] = bStoredPlyrAttk[m,c];
  562. PlyrDfns[o] = bStoredPlyrDfns[m,c];
  563. PlyrSped[1] = bStoredPlyrSped[m,c];
  564. bPlyrMove1 = bStoredPlyrMove1[m,c];
  565. bPlyrMove2 = bStoredPlyrMove2[m,c];
  566. bPlyrMove3 = bStoredPlyrMove3[m,c];
  567. bPlyrMove4 = bStoredPlyrMove4[m,c];
  568. }
  569.  
  570. Step Event:
  571.  
  572. execute code:
  573.  
  574. ///HANDLE ATTACKS QUEUE
  575.  
  576. MonExists = instance_exists(Mon);
  577.  
  578. Key = keyboard_check(ord('R'));
  579. MouseLeft = mouse_check_button(mb_left);
  580.  
  581. if Key || MouseLeft { game_restart(); }
  582.  
  583. if global.FinishedTurn = false {
  584.  
  585. if PreAttackDelay > 0 { //if delay is greater than zero
  586.     PreAttackDelay -= 0.2; //subtract 0.2
  587. }
  588.  
  589. if PreAttackDelay <= 0 { //if delay is less than or equal to zero
  590.     PreAttackDelay = -1; //set it to zero incase value goes less than zero
  591. }
  592.  
  593. if PreAttackDelay > 0 { //if delay is greater than zero
  594.     PreAttackDelay -= 0.2; //subtract 0.2
  595. }
  596.  
  597. if PostAttackDelay <= 0 { //if delay is less than or equal to zero
  598.     PostAttackDelay = -1; //set it to zero incase value goes less than zero
  599. }
  600.  
  601. }
  602.  
  603. with(Mon) {
  604. if o = 0 && aMoveSelected = true && Waiting[o] = false {
  605.     Waiting[o] = true;
  606.     switch(other.SelectedMove) {
  607.         case 0:
  608.             StoredText[o] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove1])+"!";
  609.             global.aDamageInflicted = (Var.MovePower[aPlyrMove1]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
  610.             break;
  611.         case 1:
  612.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove2])+"!";
  613.             global.aDamageInflicted = (Var.MovePower[aPlyrMove2]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
  614.             break;
  615.         case 2:
  616.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove3])+"!";
  617.             global.aDamageInflicted = (Var.MovePower[aPlyrMove3]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
  618.             break;
  619.         case 3:
  620.             StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove4])+"!";
  621.             global.aDamageInflicted = (Var.MovePower[aPlyrMove4]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
  622.             break;
  623.     }
  624.     //global.PlayerQueue += 1;
  625.     }
  626. if o = 1 && bMoveSelected = true && Waiting[o] = false {
  627.     Waiting[o] = true;
  628.     switch(other.OtherSelectedMove) {
  629.         case 0:
  630.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove1])+"!";
  631.             global.bDamageInflicted = (Var.MovePower[bPlyrMove1]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
  632.             break;
  633.         case 1:
  634.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove2])+"!";
  635.             global.bDamageInflicted = (Var.MovePower[bPlyrMove2]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
  636.             break;
  637.         case 2:
  638.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove3])+"!";
  639.             global.bDamageInflicted = (Var.MovePower[bPlyrMove3]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
  640.             break;
  641.         case 3:
  642.             StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove4])+"!";
  643.             global.bDamageInflicted = (Var.MovePower[bPlyrMove4]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
  644.             break;
  645.     }
  646.     //global.PlayerQueue += 1;
  647.     }
  648. }
  649.  
  650. //BEGIN ATTACKING ONCE EVERYONE HAS SELECTED A MOVE
  651. //DETERMINE WHO IS FASTER FIRST TO BUILD A QUEUE
  652.  
  653. if (global.PlayerQueue >= 2) {
  654.  
  655.     global.FinishedTurn = false; //allows text box to fire off attack cmds
  656.    
  657.     //check 'o' value of Mon object and see who is faster
  658.             with(Mon) {
  659.             if (o = 0) {
  660.             if ((global.aStoredPlyrSped > global.bStoredPlyrSped) && aMoveSelected = true && bMoveSelected = true) {
  661.                 if global.Player1Moving = false && global.Player1DoneMoving = true {
  662.                     global.Player1Moving = true;
  663.                     global.Player1DoneMoving = false;
  664.                     other.PreAttackDelay = 2;
  665.                     }
  666.                 if global.Player1Moving = true {
  667.                     other.message_text = StoredText[0];
  668.                     }
  669.             }
  670.             }
  671.             if (o = 0 && other.PreAttackDelay <= 0 && global.Player1DoneMoving = false) {
  672.                     global.Player2Damaged = true;
  673.                 }
  674.             }
  675.            
  676.             with(Mon) {
  677.             if (o = 1 && global.Player2DoneMoving = true) {
  678.             if ((global.aStoredPlyrSped <= global.bStoredPlyrSped) && bMoveSelected = true && aMoveSelected = true ) {
  679.                 if global.Player2Moving = false && global.Player2DoneMoving = true {
  680.                     global.Player2Moving = true;
  681.                     global.Player2DoneMoving = false;
  682.                     other.PreAttackDelay = 2;
  683.                     }
  684.                 if global.Player2Moving = true {
  685.                     other.message_text = StoredText[1];
  686.                     }
  687.                 if other.PreAttackDelay <= 0 {
  688.                     global.Player1Damaged = true;
  689.                 }
  690.             }
  691.             }
  692.             if (o = 1 && other.PreAttackDelay <= 0 && global.Player2DoneMoving = false) {
  693.                     global.Player1Damaged = true;
  694.                 }
  695.             }
  696. }
  697.  
  698. if (MonExists)
  699. if (global.Player1Moving = false && global.Player2Moving = false && global.FinishedTurn = false) {
  700.     global.FinishedTurn = true; //finish the turn
  701.     global.PlayerQueue = 0;
  702. }
  703.        
  704.    
  705.  
  706. Draw Event:
  707.  
  708. execute code:
  709.  
  710. /*
  711.  
  712. x1y1====================================
  713. ========================================
  714. ========================================
  715. ====================================x2y2
  716.  
  717. */
  718. padding = 32;
  719. box_height = 128;
  720. textboxcolor = c_white;
  721.  
  722. box_left = view_xview+padding;
  723. box_top = view_yview+view_hview-padding-box_height;
  724. box_right = view_xview+view_wview-padding;
  725. box_bottom = view_yview+view_hview-padding;
  726.  
  727. with(Mon) {
  728.     if o = 0 {
  729.         other.aSideName = PlyrName[0];
  730.         }
  731.     if o = 1 {
  732.         other.bSideName = PlyrName[1];
  733.         }
  734. }
  735.  
  736. draw_set_color(textboxcolor);
  737. draw_rectangle(box_left,box_top,box_right,box_bottom,false)
  738.  
  739. if global.FinishedTurn = true {
  740.     message_text = "What will "+string(aSideName)+" do?"
  741. }
  742.  
  743. // display text message
  744.  
  745. text_draw(box_left*1.3,box_top*1.01,string(message_text),c_black);
  746.  
  747. Left = keyboard_check_pressed(vk_left);
  748. Right = keyboard_check_pressed(vk_right);
  749. Up = keyboard_check_pressed(vk_up);
  750. Down = keyboard_check_pressed(vk_down);
  751. Select = keyboard_check_pressed(vk_enter);
  752. maxStringWidth = "ThisIsTheMaxStringLimit";
  753. longestString = string_width(maxStringWidth);
  754. MoveColor1 = c_black;
  755. MoveColor2 = c_black;
  756. MoveColor3 = c_black;
  757. MoveColor4 = c_black;
  758.  
  759. /* Moves
  760.  
  761.   0  |  1
  762. -----------
  763.   2  |  3
  764.  
  765. */
  766.  
  767. if delay > 0 {
  768.     delay -= 0.2;
  769. }
  770.  
  771. if (Left && delay = 0)
  772. if (SelectedMove = 1 || SelectedMove = 3) {
  773.     SelectedMove -= 1;
  774.     delay = 0.6;
  775. }
  776.  
  777. if (Left && delay = 0)
  778. if (SelectedMove = 0 || SelectedMove = 2) {
  779.     SelectedMove += 1;
  780.     delay = 0.6;
  781. }
  782.  
  783. if (Right && delay = 0)
  784. if (SelectedMove = 0 || SelectedMove = 2) {
  785.     SelectedMove += 1;
  786.     delay = 0.6;
  787. }
  788.  
  789. if (Right && delay = 0)
  790. if (SelectedMove = 1 || SelectedMove = 3) {
  791.     SelectedMove -= 1;
  792.     delay = 0.6;
  793. }
  794.  
  795. if (Up && delay = 0)
  796. if (SelectedMove = 2 || SelectedMove = 3) {
  797.     SelectedMove -= 2;
  798.     delay = 0.6;
  799. }
  800.  
  801. if (Up && delay = 0)
  802. if (SelectedMove = 0 || SelectedMove = 1) {
  803.     SelectedMove += 2;
  804.     delay = 0.6;
  805. }
  806.  
  807. if (Down && delay = 0)
  808. if (SelectedMove = 0 || SelectedMove = 1) {
  809.     SelectedMove += 2;
  810.     delay = 0.6;
  811. }
  812.  
  813. if (Down && delay = 0)
  814. if (SelectedMove = 2 || SelectedMove = 3) {
  815.     SelectedMove -= 2;
  816.     delay = 0.6;
  817. }
  818.  
  819.  
  820. switch(SelectedMove) {
  821.     case 0:
  822.         MoveColor1 = c_yellow;
  823.         MoveColor2 = c_black;
  824.         MoveColor3 = c_black;
  825.         MoveColor4 = c_black;
  826.         break;
  827.     case 1:
  828.         MoveColor1 = c_black;
  829.         MoveColor2 = c_yellow;
  830.         MoveColor3 = c_black;
  831.         MoveColor4 = c_black;  
  832.         break;
  833.     case 2:
  834.         MoveColor1 = c_black;
  835.         MoveColor2 = c_black;
  836.         MoveColor3 = c_yellow;
  837.         MoveColor4 = c_black;  
  838.         break;
  839.     case 3:
  840.         MoveColor1 = c_black;
  841.         MoveColor2 = c_black;
  842.         MoveColor3 = c_black;
  843.         MoveColor4 = c_yellow;  
  844.         break;
  845. }
  846.  
  847. if Left { debugger = true; }
  848.  
  849. if debugger = true {
  850. text_draw(box_left*1.3,box_top*0.90,"Player Queue: "+string(global.PlayerQueue),c_black);
  851. //text_draw(box_left*1.3,box_top*0.85,"bSelected: "+string(Mon.bMoveSelected),c_black);
  852. //text_draw(box_left*1.3,box_top*0.80,"aSelected: "+string(Mon.aMoveSelected),c_black);
  853. text_draw(box_left*1.3,box_top*0.70,"bMoving: "+string(global.Player2Damaged),c_black);
  854. text_draw(box_left*1.3,box_top*0.65,"aMoving: "+string(global.Player1Damaged),c_black);
  855. //text_draw(box_left*1.3,box_top*0.70,"bDamageInflicted: "+string(global.bDamageInflicted),c_black);
  856. //text_draw(box_left*1.3,box_top*0.65,"aDamageInflicted: "+string(global.aDamageInflicted),c_black);
  857. text_draw(box_left*1.3,box_top*0.75,"FinishedTurn: "+string(global.FinishedTurn),c_black);
  858. text_draw(box_left*1.3,box_top*0.85,"PreAttackDelay: "+string(PreAttackDelay),c_black);
  859. text_draw(box_left*1.3,box_top*0.80,"PostAttackDelay: "+string(PostAttackDelay),c_black);
  860. }
  861.  
  862. with(Mon) {
  863. if other.Select && aMoveSelected = false {
  864.     aMoveSelected = true;
  865.     global.PlayerQueue += 1;
  866.     if bMoveSelected = false {
  867.         bMoveSelected = true;
  868.         global.PlayerQueue += 1;
  869.     }
  870.     //global.PlayerQueue += 1;
  871.     }
  872. }
  873.  
  874. // display the movepool
  875.  
  876. text_draw(box_right-(longestString*2)-(padding*2),box_top*1.08,string(Var.MoveName[Mon.aPlyrMove1]),MoveColor1);
  877. text_draw(box_right-padding-string_width(string(Var.MoveName[Mon.aPlyrMove2])),box_top*1.08,string(Var.MoveName[Mon.aPlyrMove2]),MoveColor2);
  878. text_draw(box_right-(longestString*2)-(padding*2),box_top*1.15,string(Var.MoveName[Mon.aPlyrMove3]),MoveColor3);
  879. text_draw(box_right-padding-string_width(string(Var.MoveName[Mon.aPlyrMove4])),box_top*1.15,string(Var.MoveName[Mon.aPlyrMove4]),MoveColor4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement