Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IGNORE THE YELLOW TEXT !!!
- //COLORED LIKE THIS
- Information about object: Var
- Sprite:
- Solid: false
- Visible: true
- Depth: 0
- Persistent: false
- Parent:
- Children:
- Mask:
- No Physics Object
- Create Event:
- execute code:
- ///GENERATE POKEMON VARIABLES
- MonAmount = 4;
- for( i=0; i<MonAmount; i++ ) //generate our MON IDs
- {
- //generate the database for our mons so we retrieve these values
- //when battling and store them in the player values.
- //these will need to be edited manually
- Id[i] = i;
- NameId[i] = "";
- HlthId[i] = 0;
- AttkId[i] = 0;
- DfnsId[i] = 0;
- SpedId[i] = 0;
- }
- for( p=0; p<2; p++ ) //generate our player mon objects
- {
- //there will be a pair of these variable
- //Plyr[0] being the client player
- //Plyr[1] being the opposing player
- PlyrName[p] = "";
- PlyrHlth[p] = 0;
- PlyrAttk[p] = 0;
- PlyrDfns[p] = 0;
- PlyrSped[p] = 0;
- }
- execute code:
- ///MOVE STATS
- Moves = 10;
- for ( i=0; i<Moves; i++ ) {
- MovePower[i] = 1;
- MoveName[i] = "Move Name";
- }
- MoveName[0] = "Tackle";
- MovePower[0] = 40;
- MoveName[1] = "Dorito Slap";
- MovePower[1] = 60;
- MoveName[2] = "Donut Pounce";
- MovePower[2] = 60;
- MoveName[3] = "Cinnamon Dust";
- MovePower[3] = 60;
- MoveName[4] = "Ice Beam";
- MovePower[4] = 90;
- MoveName[5] = "Water Gun";
- MovePower[5] = 60;
- MoveName[6] = "Sparkle Ray";
- MovePower[6] = 90;
- MoveName[7] = "Flamethrower";
- MovePower[7] = 90;
- MoveName[8] = "Energy Ball";
- MovePower[8] = 90;
- MoveName[9] = "Shadow Ball";
- MovePower[9] = 90;
- MoveName[10] = "Big Kick";
- MovePower[10] = 120;
- execute code:
- ///POKEMON STAT CONSTANTS, DO NOT REFERENCE DIRECTLY!!!
- /* TEMPLATE
- NameId[0] = "";
- HlthId[0] = 0;
- AttkId[0] = 0;
- DfnsId[0] = 0;
- SpedId[0] = 0;
- */
- /*
- THESE ARE CONSTANTS, THEREFORE THESE
- WONT BE REFERENCED DIRECTLY!!!
- WE USE THE PlyrId VARIABLES INSTEAD!!!
- */
- NameId[0] = "Dorito";
- HlthId[0] = 90;
- AttkId[0] = 120;
- DfnsId[0] = 100;
- SpedId[0] = 80;
- NameId[1] = "Cinnamon Bun";
- HlthId[1] = 100;
- AttkId[1] = 110;
- DfnsId[1] = 120;
- SpedId[1] = 53;
- NameId[2] = "Glazed Donut";
- HlthId[2] = 110;
- AttkId[2] = 93;
- DfnsId[2] = 80;
- SpedId[2] = 144;
- NameId[3] = "Pizza";
- HlthId[3] = 130;
- AttkId[3] = 130;
- DfnsId[3] = 90;
- SpedId[3] = 20;
- Step Event:
- execute code:
- ///STORING VALUES
- /* store ids of mons so they are specifically
- choosen in battle, where 'm' represents
- the id of the mon and 'p' represents which mon
- you are in control of */
- /* m = mon id */
- /* p = player number (0 or 1) */
- /*
- if update = true {
- with(Mon) {
- switch(o) {
- // check if o = control player "0" or opposing player "1"
- case 0:
- aStoredPlyrName[m,o] = Var.PlyrName[o]
- aStoredPlyrHlth[m,o] = Var.PlyrHlth[o]
- aStoredPlyrAttk[m,o] = Var.PlyrAttk[o]
- aStoredPlyrDfns[m,o] = Var.PlyrDfns[o]
- aStoredPlyrSped[m,o] = Var.PlyrSped[o]
- break;
- case 1:
- bStoredPlyrName[m,o] = Var.PlyrName[o]
- bStoredPlyrHlth[m,o] = Var.PlyrHlth[o]
- bStoredPlyrAttk[m,o] = Var.PlyrAttk[o]
- bStoredPlyrDfns[m,o] = Var.PlyrDfns[o]
- bStoredPlyrSped[m,o] = Var.PlyrSped[o]
- break;
- }
- }
- update = false;
- }
- // change Var.update to true whenever mon is changed
- Information about object: Mon
- Sprite:
- Solid: false
- Visible: true
- Depth: 0
- Persistent: false
- Parent:
- Children:
- Mask:
- No Physics Object
- Create Event:
- execute code:
- ///CREATE PLAYER ID
- o = 0; // 0 is the controlling player, 1 is the opposing player !!!
- CurrentPartyMember = 1;
- c = CurrentPartyMember;
- m = irandom_range(0,Var.MonAmount); // which pokemon are we? (note: this is changed in BattleDummy)
- DamageInflicted = 0;
- Waiting[0] = -1;
- Waiting[1] = -1;
- Waiting[0] = false;
- Waiting[1] = false;
- aDamageInflicted = 0;
- bDamageInflicted = 0;
- Plyr[o] = true;
- StoredText[0] = "text";
- StoredText[1] = "text";
- StoredText[o] = "sample text";
- StoredPower1 = 0;
- StoredPower2 = 0;
- Health[o] = 0;
- PlyrName[0] = "";
- PlyrHlth[0] = 0;
- PlyrAttk[0] = 0;
- PlyrDfns[0] = 0;
- PlyrSped[0] = 0;
- PlyrName[1] = "";
- PlyrHlth[1] = 0;
- PlyrAttk[1] = 0;
- PlyrDfns[1] = 0;
- PlyrSped[1] = 0;
- PlyrName[o] = "";
- PlyrHlth[o] = 0;
- PlyrAttk[o] = 0;
- PlyrDfns[o] = 0;
- //PlyrSped[o] = 0;
- aPlyrMove1 = 0;
- aPlyrMove2 = 0;
- aPlyrMove3 = 0;
- aPlyrMove4 = 0;
- bPlyrMove1 = 0;
- bPlyrMove2 = 0;
- bPlyrMove3 = 0;
- bPlyrMove4 = 0;
- MoveSelected = false;
- Waiting[o] = false; // are we done selecting a move?
- Moving[o] = false;
- IsDamaged[0] = false;
- IsDamaged[1] = false;
- PartyTotal[o] = 4; // default value, this is changed in BattleDummy
- Move[0] = 0;
- Move[1] = 1;
- Move[2] = 2;
- Move[3] = 3;
- aMoveSelected = false;
- bMoveSelected = false;
- for ( n=0; n<PartyTotal[o]; n++ ) {
- // PLAYER ONE
- aStoredPlyrName[m,n] = "";
- aStoredPlyrHlth[m,n] = 0;
- aStoredPlyrHlthCache[m,n] = 0;
- aStoredPlyrAttk[m,n] = 0;
- aStoredPlyrDfns[m,n] = 0;
- aStoredPlyrSped[m,n] = 0;
- aStoredPlyrMove1[m,n] = irandom_range(0,Var.Moves);
- aStoredPlyrMove2[m,n] = irandom_range(0,Var.Moves);
- aStoredPlyrMove3[m,n] = irandom_range(0,Var.Moves);
- aStoredPlyrMove4[m,n] = irandom_range(0,Var.Moves);
- // PLAYER TWO
- bStoredPlyrName[m,n] = "";
- bStoredPlyrHlth[m,n] = 0;
- bStoredPlyrHlthCache[m,n] = 0;
- bStoredPlyrAttk[m,n] = 0;
- bStoredPlyrDfns[m,n] = 0;
- bStoredPlyrSped[m,n] = 0;
- bStoredPlyrMove1[m,n] = irandom_range(0,Var.Moves);
- bStoredPlyrMove2[m,n] = irandom_range(0,Var.Moves);
- bStoredPlyrMove3[m,n] = irandom_range(0,Var.Moves);
- bStoredPlyrMove4[m,n] = irandom_range(0,Var.Moves);
- }
- /*
- If ((Player[a].Health > (Player[a].Health - Player[b].DamageInflicted))
- && Player[a].IsDamaged = true) {
- Player[a].Health -= 1/128 //lose health at 1/128 rate if damaged by opponent.
- }
- 100 > (100 - 50)
- which is 50
- */
- execute code:
- ///MOVE STATS
- Moves = 10;
- for ( i=0; i<Moves; i++ ) {
- MovePower[i] = 1;
- MoveName[i] = "Move Name";
- }
- MoveName[0] = "Tackle";
- MovePower[0] = 40;
- MoveName[1] = "Dorito Slap";
- MovePower[1] = 60;
- MoveName[2] = "Donut Pounce";
- MovePower[2] = 60;
- MoveName[3] = "Cinnamon Dust";
- MovePower[3] = 60;
- MoveName[4] = "Ice Beam";
- MovePower[4] = 90;
- MoveName[5] = "Water Gun";
- MovePower[5] = 60;
- MoveName[6] = "Sparkle Ray";
- MovePower[6] = 90;
- MoveName[7] = "Flamethrower";
- MovePower[7] = 90;
- MoveName[8] = "Energy Ball";
- MovePower[8] = 90;
- MoveName[9] = "Shadow Ball";
- MovePower[9] = 90;
- MoveName[10] = "Big Kick";
- MovePower[10] = 120;
- Step Event:
- execute code:
- if o = 0
- {
- Position = "back";
- sprite_index = spr_mon_back;
- image_xscale = 2;
- image_yscale = 2;
- image_speed = 0;
- image_index = m;
- x = view_xview + view_wview*0.2;
- y = view_yview + view_hview*0.6;
- global.aStoredPlyrName = aStoredPlyrName[m,c]
- global.aStoredPlyrHlth = aStoredPlyrHlth[m,c]
- global.aStoredPlyrAttk = aStoredPlyrAttk[m,c]
- global.aStoredPlyrDfns = aStoredPlyrDfns[m,c]
- global.aStoredPlyrSped = aStoredPlyrSped[m,c]
- global.aX = x
- global.aY = y
- }
- if o = 1
- {
- Position = "front";
- sprite_index = spr_mon_front;
- image_xscale = 2;
- image_yscale = 2;
- image_speed = 0;
- image_index = m;
- //x = view_xview + view_wview*0.8;
- //y = view_yview + view_hview*0.4;
- x = view_wview - view_wview*0.2;
- y = view_hview - view_hview*0.6;
- global.bStoredPlyrName = bStoredPlyrName[m,c]
- global.bStoredPlyrHlth = bStoredPlyrHlth[m,c]
- global.bStoredPlyrAttk = bStoredPlyrAttk[m,c]
- global.bStoredPlyrDfns = bStoredPlyrDfns[m,c]
- global.bStoredPlyrSped = bStoredPlyrSped[m,c]
- global.bX = x
- global.bY = y
- }
- // if we are damaged at all...
- // if player 1 is damaged by player 2
- if (o = 0 && global.bFinishQueue = 0 && global.Player1Damaged = true && global.aHealth > 0 && global.aWaiting = true) {
- if (global.aHealth > (aStoredPlyrHlthCache[m,c] - global.bDamageInflicted)) {
- global.aHealth -= 1/4; //lose health at 1/4 rate if damaged
- }
- if (global.aHealth <= (aStoredPlyrHlthCache[m,c] - global.bDamageInflicted)) {
- global.Player1Moving = false;
- global.Player1DoneMoving = true;
- global.Player1Damaged = false;
- global.bFinishQueue = 1;
- }
- }
- // if player 2 is damaged by player 1
- if (o = 1 && global.aFinishQueue = 0 && global.Player2Damaged = true && global.bHealth > 0 && global.bWaiting = true) {
- if (global.bHealth > (bStoredPlyrHlthCache[m,c] - global.aDamageInflicted)) {
- global.bHealth -= 1/4; //lose health at 1/4 rate if damaged
- }
- if (global.bHealth <= (bStoredPlyrHlthCache[m,c] - global.aDamageInflicted)) {
- global.Player2Moving = false;
- global.Player2DoneMoving = true;
- global.Player2Damaged = false;
- global.aFinishQueue = 1;
- }
- }
- if (o = 0 && global.Player1DoneMoving = true && global.Player2DoneMoving = true/*global.aWaiting = false*/) {
- aStoredPlyrHlthCache[m,c] = global.aHealth;
- }
- if (o = 1 && global.Player1DoneMoving = true && global.Player2DoneMoving = true/*global.bWaiting = false*/) {
- bStoredPlyrHlthCache[m,c] = global.bHealth;
- }
- Draw Event:
- execute code:
- //x1 = x-64*2*1.2;
- //y1 = y-64*2*1.4;
- //x2 = x+64*2*1.2;
- //y2 = y-64*2*1.2;
- x1 = 128*1.2;
- y1 = 128*1.4;
- x2 = 128*1.2;
- y2 = 128*1.2;
- if o = 0 {
- aX1 = global.aX-x1;
- aY1 = global.aY-y1;
- aX2 = global.aX+x2;
- aY2 = global.aY-y2;
- }
- if o = 1 {
- bX1 = global.bX-x1;
- bY1 = global.bY-y1;
- bX2 = global.bX+x2;
- bY2 = global.bY-y2;
- }
- xdiff = x2-x1
- draw_sprite(sprite_index,image_index,x,y);
- draw_set_font(font0);
- draw_set_color(c_teal);
- draw_rectangle(x-x1,y-y1,x+x2,y-y2,false);
- draw_set_color(c_yellow);
- //text_draw(x1,y1-100,"Error: "+string(bStoredPlyrSped[m,c]),c_black);
- if o = 0 {
- draw_rectangle(aX1,aY1,aX2*(global.aHealth/aStoredPlyrHlth[m,c]),aY2,false)
- text_draw(aX1,aY1-24,PlyrName[0],c_white);
- text_draw(aX1,aY1+14*2/1.25,"HP: "+string(global.aHealth)+"/"+string(aStoredPlyrHlth[m,c]),c_white);
- text_draw(aX1,aY1+39,"aPlyrHlthCache: "+string(aStoredPlyrHlthCache[m,c]),c_black);
- text_draw(aX1,aY1+55,"aX: "+string(aX1),c_black);
- text_draw(aX1,aY1+69,"aX1: "+string(aX2*(global.aHealth/aStoredPlyrHlth[m,c])),c_black);
- }
- if o = 1 {
- draw_rectangle(bX1,bY1,bX2*(global.bHealth/bStoredPlyrHlth[m,c]),bY2,false)
- text_draw(bX1,bY1-24,PlyrName[1],c_white);
- text_draw(bX1,bY1+14*2/1.25,"HP: "+string(global.bHealth)+"/"+string(bStoredPlyrHlth[m,c]),c_white);
- text_draw(bX1,bY1+39,"bPlyrHlthCache: "+string(bStoredPlyrHlthCache[m,c]),c_black);
- text_draw(bX1,bY1+55,"bX: "+string(bX1),c_black);
- text_draw(bX1,bY1+69,"bX1: "+string(bX2*(global.bHealth/bStoredPlyrHlth[m,c])),c_black);
- }
- Information about object: BattleDummy
- Sprite:
- Solid: false
- Visible: true
- Depth: 0
- Persistent: false
- Parent:
- Children:
- Mask:
- No Physics Object
- Create Event:
- execute code:
- /// FETCH VALUES FOR POKEMON ON THE FIELD
- // Var object holds all the constants
- // IMPORTANT vvvvvvvvvv
- // m = mon id;
- // c = position in party;
- // IMPORTANT ^^^^^^^^^^
- debugger = false;
- message_text = "";
- instance_create(x,y,Var);
- global.PlayerQueue = 0;
- global.FinishedTurn = true;
- global.Player1Moving = false;
- global.Player2Moving = false;
- global.Player1DoneMoving = true;
- global.Player2DoneMoving = true;
- global.Player1Damaged = false;
- global.Player2Damaged = false;
- global.aHealth = 90;
- global.bHealth = 90;
- global.aDamageInflicted = 0;
- global.bDamageInflicted = 0;
- global.aWaiting = false;
- global.bWaiting = false;
- global.aFinishQueue = 0;
- global.bFinishQueue = 0;
- SelectedMove = 0;
- OtherSelectedMove = 0;
- aSideName = "";
- bSideName = "";
- delay = 0;
- PreAttackDelay = 1;
- PostAttackDelay = 1;
- /* PLAYER 1 MON ------------------------- */
- with(instance_create(x,y,Mon)) { /* PLAYER 1 MON ------------------------- */
- o = 0; // set mon to be player 1
- m = irandom_range(0,3); // for now we randomly select a mon
- image_index = m; //update sprite to appropriate mon
- // then we grab the corresponding stats for that mon
- aStoredPlyrName[m,c] = Var.NameId[m];
- aStoredPlyrHlth[m,c] = Var.HlthId[m];
- aStoredPlyrHlthCache[m,c] = Var.HlthId[m];
- aStoredPlyrAttk[m,c] = Var.AttkId[m];
- aStoredPlyrDfns[m,c] = Var.DfnsId[m];
- aStoredPlyrSped[m,c] = Var.SpedId[m];
- aStoredPlyrMove1[m,c] = irandom_range(0,Var.Moves);
- aStoredPlyrMove2[m,c] = irandom_range(0,Var.Moves);
- aStoredPlyrMove3[m,c] = irandom_range(0,Var.Moves);
- aStoredPlyrMove4[m,c] = irandom_range(0,Var.Moves);
- // now we set our local stat variables to equal the stored data
- // PlyrName[0] = aStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of your party
- global.aHealth = aStoredPlyrHlth[m,c];
- PlyrName[o] = aStoredPlyrName[m,c];
- PlyrHlth[o] = aStoredPlyrHlth[m,c];
- PlyrAttk[o] = aStoredPlyrAttk[m,c];
- PlyrDfns[o] = aStoredPlyrDfns[m,c];
- PlyrSped[0] = aStoredPlyrSped[m,c];
- aPlyrMove1 = aStoredPlyrMove1[m,c];
- aPlyrMove2 = aStoredPlyrMove2[m,c];
- aPlyrMove3 = aStoredPlyrMove3[m,c];
- aPlyrMove4 = aStoredPlyrMove4[m,c];
- }
- /* PLAYER 2 MON ------------------------- */
- with(instance_create(x,y,Mon)) { /* PLAYER 2 MON ------------------------- */
- o = 1; // set mon to be player 2
- m = irandom_range(0,3); // for now we randomly select a mon
- image_index = m; //update sprite to appropriate mon
- // then we grab the corresponding stats for that mon
- bStoredPlyrName[m,c] = Var.NameId[m];
- bStoredPlyrHlth[m,c] = Var.HlthId[m];
- bStoredPlyrHlthCache[m,c] = Var.HlthId[m];
- bStoredPlyrAttk[m,c] = Var.AttkId[m];
- bStoredPlyrDfns[m,c] = Var.DfnsId[m];
- bStoredPlyrSped[m,c] = Var.SpedId[m];
- bStoredPlyrMove1[m,c] = irandom_range(0,Var.Moves);
- bStoredPlyrMove2[m,c] = irandom_range(0,Var.Moves);
- bStoredPlyrMove3[m,c] = irandom_range(0,Var.Moves);
- bStoredPlyrMove4[m,c] = irandom_range(0,Var.Moves);
- // now we set our local stat variables to equal the stored data
- //PlyrName[1] = bStoredPlyrName[1,1] <-- Mon #1 in the 1st spot of opponents party
- global.bHealth = bStoredPlyrHlth[m,c];
- PlyrName[o] = bStoredPlyrName[m,c];
- PlyrHlth[o] = bStoredPlyrHlth[m,c];
- PlyrAttk[o] = bStoredPlyrAttk[m,c];
- PlyrDfns[o] = bStoredPlyrDfns[m,c];
- PlyrSped[1] = bStoredPlyrSped[m,c];
- bPlyrMove1 = bStoredPlyrMove1[m,c];
- bPlyrMove2 = bStoredPlyrMove2[m,c];
- bPlyrMove3 = bStoredPlyrMove3[m,c];
- bPlyrMove4 = bStoredPlyrMove4[m,c];
- }
- Step Event:
- for other object: execute code:
- ///HANDLE ATTACKS QUEUE
- MonExists = instance_exists(Mon);
- Key = keyboard_check(ord('R'));
- MouseLeft = mouse_check_button(mb_left);
- if Key || MouseLeft { game_restart(); }
- if global.FinishedTurn = false {
- if PreAttackDelay > 0 { //if delay is greater than zero
- PreAttackDelay -= 0.2; //subtract 0.2
- }
- if PreAttackDelay <= 0 { //if delay is less than or equal to zero
- PreAttackDelay = -1; //set it to zero incase value goes less than zero
- }
- if PostAttackDelay > 0 { //if delay is greater than zero
- PostAttackDelay -= 0.2; //subtract 0.2
- }
- if PostAttackDelay <= 0 { //if delay is less than or equal to zero
- PostAttackDelay = -1; //set it to zero incase value goes less than zero
- }
- }
- with(Mon) {
- if o = 0 && aMoveSelected = true && global.aWaiting = false {
- global.aWaiting = true;
- switch(other.SelectedMove) {
- case 0:
- StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove1])+"!";
- global.aDamageInflicted = (Var.MovePower[aPlyrMove1]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
- break;
- case 1:
- StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove2])+"!";
- global.aDamageInflicted = (Var.MovePower[aPlyrMove2]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
- break;
- case 2:
- StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove3])+"!";
- global.aDamageInflicted = (Var.MovePower[aPlyrMove3]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
- break;
- case 3:
- StoredText[0] = PlyrName[o]+" used "+string(Var.MoveName[aPlyrMove4])+"!";
- global.aDamageInflicted = (Var.MovePower[aPlyrMove4]*(PlyrAttk[o]/global.bStoredPlyrDfns))/50+2;
- break;
- }
- //global.PlayerQueue += 1;
- }
- if o = 1 && bMoveSelected = true && global.bWaiting = false {
- global.bWaiting = true;
- switch(other.OtherSelectedMove) {
- case 0:
- StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove1])+"!";
- global.bDamageInflicted = (Var.MovePower[bPlyrMove1]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
- break;
- case 1:
- StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove2])+"!";
- global.bDamageInflicted = (Var.MovePower[bPlyrMove2]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
- break;
- case 2:
- StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove3])+"!";
- global.bDamageInflicted = (Var.MovePower[bPlyrMove3]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
- break;
- case 3:
- StoredText[1] = "The opposing "+PlyrName[o]+" used "+string(Var.MoveName[bPlyrMove4])+"!";
- global.bDamageInflicted = (Var.MovePower[bPlyrMove4]*(PlyrAttk[o]/global.aStoredPlyrDfns))/50+2;
- break;
- }
- //global.PlayerQueue += 1;
- }
- }
- //BEGIN ATTACKING ONCE EVERYONE HAS SELECTED A MOVE
- //DETERMINE WHO IS FASTER FIRST TO BUILD A QUEUE
- if (global.PlayerQueue >= 2) {
- global.FinishedTurn = false; //allows text box to fire off attack cmds
- //check 'o' value of Mon object and see who is faster
- with(Mon) {
- if (o = 0) { // player 1 moves
- if ((global.aStoredPlyrSped > global.bStoredPlyrSped) || global.bFinishQueue = 1) /*if faster or player 2 already moved*/
- {
- if (global.Player1Moving = false && aMoveSelected = true && bMoveSelected = true) {
- global.Player1Moving = true;
- global.Player1DoneMoving = false;
- other.PreAttackDelay = 2;
- other.message_text = StoredText[0];
- }
- //if player 1 is moving
- if (global.Player1Moving = true || global.bFinishQueue = 1) {
- //other.message_text = StoredText[0];
- }
- }
- }
- if (o = 0 && other.PreAttackDelay = -1 && global.Player1Moving = true && global.Player1DoneMoving = false) {
- global.Player2Damaged = true;
- }
- }
- with(Mon) {
- if (o = 1) { // player 2 moves
- if ((global.aStoredPlyrSped <= global.bStoredPlyrSped) || global.aFinishQueue = 1) //if faster or player 1 already moved
- {
- if (global.Player2Moving = false && aMoveSelected = true && bMoveSelected = true) {
- global.Player2Moving = true; // player 2 moves, damages player 1
- global.Player2DoneMoving = false;
- other.PreAttackDelay = 2;
- other.message_text = StoredText[1];
- }
- //if player 2 is moving
- if (global.Player2Moving = true || global.aFinishQueue = 1) {
- //other.message_text = StoredText[1];
- }
- }
- }
- if (o = 1 && other.PreAttackDelay = -1 && global.Player2Moving = true && global.Player2DoneMoving = false) {
- global.Player1Damaged = true;
- }
- }
- }
- if (MonExists)
- if (PreAttackDelay = -1 && global.aFinishQueue = 1 && global.bFinishQueue = 1 && global.FinishedTurn = false) {
- global.FinishedTurn = true; //finish the turn
- global.PlayerQueue = 0;
- global.Player1Moving = false;
- global.Player2Moving = false;
- global.Player1Damaged = false;
- global.Player2Damaged = false;
- global.Player1DoneMoving = true;
- global.Player2DoneMoving = true;
- global.aWaiting = 0;
- global.bWaiting = 0;
- OtherSelectedMove = irandom_range(0,3);
- with(Mon) {
- aMoveSelected = false;
- bMoveSelected = false;
- }
- global.aFinishQueue = 0;
- global.bFinishQueue = 0;
- }
- if global.FinishedTurn = true {
- message_text = "What will "+string(aSideName)+" do?"
- }
- Draw Event:
- execute code:
- /*
- x1y1====================================
- ========================================
- ========================================
- ====================================x2y2
- */
- padding = 32;
- box_height = 128;
- textboxcolor = c_white;
- box_left = view_xview+padding;
- box_top = view_yview+view_hview-padding-box_height;
- box_right = view_xview+view_wview-padding;
- box_bottom = view_yview+view_hview-padding;
- with(Mon) {
- if o = 0 {
- other.aSideName = PlyrName[0];
- }
- if o = 1 {
- other.bSideName = PlyrName[1];
- }
- }
- draw_set_color(textboxcolor);
- draw_rectangle(box_left,box_top,box_right,box_bottom,false)
- // display text message
- text_draw(box_left*1.3,box_top*1.01,string(message_text),c_black);
- Left = keyboard_check_pressed(vk_left);
- Right = keyboard_check_pressed(vk_right);
- Up = keyboard_check_pressed(vk_up);
- Down = keyboard_check_pressed(vk_down);
- Select = keyboard_check_pressed(vk_enter);
- maxStringWidth = "ThisIsTheMaxStringLimit";
- longestString = string_width(maxStringWidth);
- MoveColor1 = c_black;
- MoveColor2 = c_black;
- MoveColor3 = c_black;
- MoveColor4 = c_black;
- /* Moves
- 0 | 1
- -----------
- 2 | 3
- */
- if delay > 0 {
- delay -= 0.2;
- }
- if (Left && delay = 0)
- if (SelectedMove = 1 || SelectedMove = 3) {
- SelectedMove -= 1;
- delay = 0.6;
- }
- if (Left && delay = 0)
- if (SelectedMove = 0 || SelectedMove = 2) {
- SelectedMove += 1;
- delay = 0.6;
- }
- if (Right && delay = 0)
- if (SelectedMove = 0 || SelectedMove = 2) {
- SelectedMove += 1;
- delay = 0.6;
- }
- if (Right && delay = 0)
- if (SelectedMove = 1 || SelectedMove = 3) {
- SelectedMove -= 1;
- delay = 0.6;
- }
- if (Up && delay = 0)
- if (SelectedMove = 2 || SelectedMove = 3) {
- SelectedMove -= 2;
- delay = 0.6;
- }
- if (Up && delay = 0)
- if (SelectedMove = 0 || SelectedMove = 1) {
- SelectedMove += 2;
- delay = 0.6;
- }
- if (Down && delay = 0)
- if (SelectedMove = 0 || SelectedMove = 1) {
- SelectedMove += 2;
- delay = 0.6;
- }
- if (Down && delay = 0)
- if (SelectedMove = 2 || SelectedMove = 3) {
- SelectedMove -= 2;
- delay = 0.6;
- }
- switch(SelectedMove) {
- case 0:
- MoveColor1 = c_yellow;
- MoveColor2 = c_black;
- MoveColor3 = c_black;
- MoveColor4 = c_black;
- break;
- case 1:
- MoveColor1 = c_black;
- MoveColor2 = c_yellow;
- MoveColor3 = c_black;
- MoveColor4 = c_black;
- break;
- case 2:
- MoveColor1 = c_black;
- MoveColor2 = c_black;
- MoveColor3 = c_yellow;
- MoveColor4 = c_black;
- break;
- case 3:
- MoveColor1 = c_black;
- MoveColor2 = c_black;
- MoveColor3 = c_black;
- MoveColor4 = c_yellow;
- break;
- }
- if Left { debugger = true; }
- if debugger = true {
- text_draw(box_left*1.3,box_top*0.90,"Player Queue: "+string(global.PlayerQueue),c_black);
- //text_draw(box_left*1.3,box_top*0.85,"bSelected: "+string(Mon.bMoveSelected),c_black);
- //text_draw(box_left*1.3,box_top*0.80,"aSelected: "+string(Mon.aMoveSelected),c_black);
- text_draw(box_left*1.3,box_top*0.70,"bMoving: "+string(global.Player2Moving),c_black);
- text_draw(box_left*1.3,box_top*0.65,"aMoving: "+string(global.Player1Moving),c_black);
- //text_draw(box_left*1.3,box_top*0.70,"bDamageInflicted: "+string(global.bDamageInflicted),c_black);
- //text_draw(box_left*1.3,box_top*0.65,"aDamageInflicted: "+string(global.aDamageInflicted),c_black);
- text_draw(box_left*1.3,box_top*0.75,"FinishedTurn: "+string(global.FinishedTurn),c_black);
- text_draw(box_left*1.3,box_top*0.85,"PreAttackDelay: "+string(PreAttackDelay),c_black);
- text_draw(box_left*1.3,box_top*0.80,"PostAttackDelay: "+string(PostAttackDelay),c_black);
- }
- with(Mon) {
- if other.Select && aMoveSelected = false {
- aMoveSelected = true;
- global.PlayerQueue += 1;
- if bMoveSelected = false {
- bMoveSelected = true;
- global.PlayerQueue += 1;
- }
- //global.PlayerQueue += 1;
- }
- }
- // display the movepool
- text_draw(box_right-(longestString*2)-(padding*2),box_top*1.08,string(Var.MoveName[Mon.aPlyrMove1]),MoveColor1);
- text_draw(box_right-padding-string_width(string(Var.MoveName[Mon.aPlyrMove2])),box_top*1.08,string(Var.MoveName[Mon.aPlyrMove2]),MoveColor2);
- text_draw(box_right-(longestString*2)-(padding*2),box_top*1.15,string(Var.MoveName[Mon.aPlyrMove3]),MoveColor3);
- 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