In this final part, we wrap up the series and put the finishing touches on the game! I also show how to add in more menus, like a skills menu, and get it functional.

Check out my GameMaker Studio course on Udemy for only $9.99:

Here’s the live coded project completed:

Here’s the link to the original concept code project:

Connect with us on Twitter @ BeyondUsGames
Support us on Patreon here: patreon.com/BeyondUsGames

Nguồn: https://shaarique.com/

Xem thêm bài viết khác: https://shaarique.com/game/

11 Comments

Armoraxis

July 5, 2020

hey, so for some reason, when my Battle Controller spawns duplicate enemies, it will draw 1 health bar for the two of them, and when one dies, they both die. But I also get an error when the battle ends where it is "Unable to find any instance for object index…"
I am really stumped on this one, but other than that, I love this series!

Reply

Ja'carpet

July 5, 2020

Your series was a great tutorial and really helped, but I do have some issues that I looked into but could not figure out. I also have a couple of questions. Sorry in advanced for all the questions, you have been a major help.
1) The green line in the skills when selecting the first skill (fireball) it underlines all 3 of the skills, then when it goes the second skill(heal) it is perfectly fin, but on the third skill(Filler) it is a little bit off. Trying to fix that and really couldn't figure out how. Here's my code. if(inCombat && isChoosingSkills) {
draw_sprite(spr_skillsmenu, 0, room_width/2, room_height – 150);

for(i = 0; i < array_length_1d(skillsMenu); ++i) {
draw_text(450 + (i * 150), 450, skillsMenu[i]);

if( i == skillChosen)
draw_line_colour(450+ (i * 150), 470, 515 + (i + 150), 470, c_green, c_green);
2)The skill fireball literally just ends that match and does not destroy the other party members. I could probably fix that by making skills do their own independent thing and I do not know how to go about that.
3)How could I give enemies skills and make them use those skills?
4)Could I just place the skills array inside different character objects and they would come out as different skills when selected or is there more to that?

Thank you again and thanks for reading.

Reply

William Ulrich

July 5, 2020

@beyond US Games sorry for bothering you with all these questions but i just have one more. how would i go about being able to add or remove party members from the party. i've been trying for a few days and can't think of a way to do it.

Reply

William Ulrich

July 5, 2020

@ Beyond Us Games
So this Series was awesome and helped me out allot with the starting points of my combat system for my game. i have run into a slight snag though. can't seem to figure out how to make certain encounters not spawn extra enemies. like for example i have a tutorial unit set up and i want him to be by himself. anything you'd suggest i do to get the desired result?

Reply

Cordell Ruzewski

July 5, 2020

So the Problem that I'm having is when I run into an enemy.
The game doesn't crash, or have any errors at all.
The issue is simple, when I run into an enemy, the player that I'm spawning (the one the user controls) appears wherever he feels like. It seems to be quite related to where he is in the room before the battle, but still. How might I fix this issue? Here is the code from the CharParent:

(Collision with EnemyParent)
///Begin Battle

enemyID = other.id.object_index;
deadEnemies = 0;

for( i = 0; i < array_length_1d(enemyID.myGroup); ++i)
{
enemyParty[i] = enemyID.myGroup[i];
}
objBattleController.alarm[0] = 1;

instance_create(0, 0, eFade);

with(other)
instance_destroy();

room_goto(rm_battle);

inCombat = true;
isSelectingPlayer = true;

beforeBattleX = x;
beforeBattleY = y;

playerParty[0].x = 200; //Also tried using the regular x and y, both are the same result
playerParty[0].y = 200;
image_speed = 0;
image_index = 0;
sprite_index = playerParty[0].myAnims[4];

Reply

Nomorevirusplz gamer

July 5, 2020

great stuff! watched it all and really had fun adding to what you started! Thanks!

Reply

Ivan

July 5, 2020

The issue is that on your videos you show only one person walking around. I have 3 marines walking around.

https://youtu.be/2llG48GehM4
(skip to 0:20 –0:37 youll see my other 2 marines go back to their start x and start y and not where they were before the battle started)

i cant get the other two marines to got back to x and y before the battle started.

Reply

NotDave

July 5, 2020

So i have an error when i try to go into a second battle after i have done one. i get this
Creating instance for non-existing object: 100100
at gml_Object_obj_battlecontrol_ObjAlarm0_1 (line 13) – enemyParty[i] = instance_create(800, 200 + (i * 200), enemyParty[i]);

can you help and dose this happen in yours?

Reply

Stuart Thompson

July 5, 2020

This was a great series of tutorials. Thanks!

Reply

Nick Lattan

July 5, 2020

hey i need help i really want to be able to save my other party members stats and am not able to figure it out. any decently easy ideas im pretty new to this stuff but pretty much understand all tutorials i have watched so idk. any help would be appreciated

Reply

Logan Bartholomew

July 5, 2020

Hello i have been coding and the glitch that has happen where my player duplicates after combat has happen again and my skills menu isnt working here is the code
///Menu Selection during battels
if(inCombat)
{
//Choosing a player///
if(isSelectingPlayer)
{
if(keyboard_check_pressed(ord("S")))
playerChosen = clamp(++playerChosen, 0, array_length_1d(playerParty) – 1);
if(keyboard_check_pressed(ord("W")))
playerChosen = clamp(–playerChosen, 0, array_length_1d(playerParty) – 1);

//Choose to act with player
if(keyboard_check_pressed(vk_space) && (playerParty[playerChosen].isActive == false))
{
show_message("Player is Dead")
}
else if(keyboard_check_pressed(vk_enter) || keyboard_check_pressed(vk_space))
{
isSelectingPlayer = false;
isSelectingFromMenu = true;
}
}

///Choosing from menu/////
else if(isSelectingFromMenu)
{

if(keyboard_check_pressed(ord("A")))
{
if((battleMenuSelection – 1) <0)
battleMenuSelection = (array_length_1d(battleMenu) – 1)
else
–battleMenuSelection
}
else if(keyboard_check_pressed(ord("D")))
{
if(battleMenuSelection + 1 ) > (array_length_1d(battleMenu) – 1)
battleMenuSelection = 0;
else
++battleMenuSelection
}

//Selection the enemy
if(battleMenuSelection == 0 && keyboard_check_pressed(vk_space))
{
if(!selectingEnemy)
{
selectingEnemy = true;
isSelectingFromMenu = false;
}
}

//Defend
if(battleMenuSelection == 1 && keyboard_check_pressed(vk_space))
{
if(playerParty[playerChosen].currentEnergy > (playerParty[playerChosen].maxEnergy/2))
{
isDefending = true;
playerParty[playerChosen].currentEnergy -= (playerParty[playerChosen].maxEnergy/2);
}
}
//Skills Menu
if(battleMenu[2] == 2 && (keyboard_check_pressed(vk_space)))
{
isChoosingSkills = true;
isSelectingFromMenu = false;
}

//Running Away
if(battleMenuSelection == 3 && keyboard_check_pressed(vk_space) && playerParty[playerChosen].currentEnergy >= (playerParty[playerChosen].maxEnergy/2))
{
playerParty[playerChosen].currentEnergy -= (playerParty[playerChosen].maxEnergy/2);
if (irandom_range(0, 3) == 1)
{
ranAway = true;
}
isDefending = false;
}
if(keyboard_check_pressed(vk_escape))
{
isSelectingFromMenu = false;
isSelectingPlayer = true;
}
}
else if(isChoosingSkills)
{

if(keyboard_check_pressed(ord("D")))
{
skillsChosen = clamp(++skillsChosen, 0, array_length_1d(skillsMenu) – 1);
}

if(keyboard_check_pressed(ord("A")))
{
skillsChosen = clamp(–skillsChosen, 0, array_length_1d(skillsMenu) – 1);
}

if(keyboard_check_pressed(vk_escape))
{
isChoosingSkills = false;
isSelectingFromMenu = true;
}

}

//////Chosing Enemy//////
else if(selectingEnemy)
{
if(keyboard_check_pressed(ord("S")))
enemyChosen = clamp(++enemyChosen, 0, array_length_1d(enemyParty) -1);
if(keyboard_check_pressed(ord("W")))
enemyChosen = clamp(–enemyChosen, 0, array_length_1d(enemyParty) -1);
///Atacking the Enemy
if(keyboard_check_pressed(vk_space) && (enemyParty[enemyChosen].isActive == false))
{
show_message("Enemy is Already Dead");
}
else if(keyboard_check_pressed(vk_space) && playerParty[playerChosen].currentEnergy >= playerParty[playerChosen].maxEnergy && selectingEnemy)
{
playerAttacking = true;
playerParty[playerChosen].sprite_index = playerParty[playerChosen].myAnims[4];
playerParty[playerChosen].image_speed = 0.1;
playerParty[playerChosen].currentEnergy = 0;
selectingEnemy = false;
isDefending = false;
}
}

//Undoing the Selection
if(keyboard_check(vk_escape) && selectingEnemy)
{
selectingEnemy = false;
isSelectingFromMenu = true;
}
}

///Setting UP Controller
globalvar inCombat, enemyID, battleMenuSelection, choosingEnemy, enemySelction, playerAttacking, ranAway, isDefending;
inCombat = false ;
enemyID = 0;
battleMenuSelection = 0 ;
selectingEnemy = false;
enemySelection = 0;
playerAttacking = false;
ranAway = false;

//Battle Menu
battleMenu[0] = "Attack";
battleMenu[1] = "Defend";
battleMenu[2] = "Skills";
battleMenu[3] = "Run Away";

//Arrays
globalvar playerParty, enemyParty;
playerParty[0] = objSara;
playerParty[1] = objVera;

//More vars
globalvar isSelectingPlayer, isSelectingFromMenu, playerChosen, enemyChosen, deadEnemies, isChoosingSkills, drawSkills, skillsChosen, skillsMenu;
isSelectingPlayer = false;
isSelectingFromMenu = false;
playerChosen = 0;
enemyChosen = 0;
deadEnemies = 0;
isChoosingSkills = false;
drawSkills = false;
skillsChosen = 0;
skillsMenu[0] = "FireBall";
skillsMenu[1] = "Heal";
skillsMenu[2] = "Lightnig";

///Drawing Battle Menu Options
if(inCombat && !isChoosingSkills)
{
for(i = 0; i < array_length_1d(battleMenu); ++ i)
{
draw_text(200 * i + 450, 660, battleMenu[i]);

if(i == battleMenuSelection)
{
draw_line_colour(200 * i + 445, 680 , 200 * i + 510, 680, c_red, c_red)
}
}
}

if(inCombat && isChoosingSkills)
{
draw_sprite(SprSkillsMenu, 0, room_width/2, room_height – 150);

for(i = 0; i < array_length_1d(skillsMenu[i]); ++ i)
{
draw_text(450 + (i * 150), 450, skillsMenu[i]);
}
if (i == skillsChosen)
{
draw_line_colour(450 + (i * 150), 470, 515 + (i * 150), 470, c_green, c_green);
}
}

Reply

Leave a Reply