B
bobula13
Guest
When I first started programming with GameMaker, one of the first things I wanted to work on was an old school, NES Dragon Warrior/Quest RPG. I have fond memories of wasting my youth playing these games and thought it would be great to make my own. One of the more frustrating things when trying to learn how to create a game like this was trying to find tutorials. Most of the time they were for turn based strategy games and for whatever reason I wasn't able to apply it to what I was trying to achieve. When you look through the forums here, most of the time you get the response of "learn it on your own".
Lately I've been working on a basic combat engine for these old school type of games and I thought that it would be neat to share it with the GM community. As a forewarning, I know that this is far from perfect, and I am not the best programmer. But in putting this out there I thought it would be great to see what ways anyone could improve on this.
I don't have any screen shots for this because I literally have two squares in a room. So please use your imagination and pretend that I am an amazing artist and there are two fearless combatants fighting to the death.
First off, I created three objects: a player, an enemy and a battle controller. Both the player and enemy have no code in them for now and are just placed in the room. Since I have not added any kind of attributes/statistics yet for the ACTUAL combat, they're just bare bones figures.
The look of this is to have the opponents choose their attack, move forward toward their opponent, complete their attack and move back. Then the turn goes back to the other opponent.
Here are the variables in the create event of the battle controller:
Next in the Step event are the state machines for combat:
And here is alarm 0 and 1:
Like I mentioned before, I am not the best programmer and a lot of this may seem real sloppy, but it works to get the general feel or look down. Right now I am working on actually implementing the combat with attributes, deciding initiative, hit or miss attacks, damage and if you can run away or not.
Tell me what you think, if this is something that interests you at all, and if you have any ideas on how to improve the very, VERY, basics of this system so far.
Lately I've been working on a basic combat engine for these old school type of games and I thought that it would be neat to share it with the GM community. As a forewarning, I know that this is far from perfect, and I am not the best programmer. But in putting this out there I thought it would be great to see what ways anyone could improve on this.
I don't have any screen shots for this because I literally have two squares in a room. So please use your imagination and pretend that I am an amazing artist and there are two fearless combatants fighting to the death.
First off, I created three objects: a player, an enemy and a battle controller. Both the player and enemy have no code in them for now and are just placed in the room. Since I have not added any kind of attributes/statistics yet for the ACTUAL combat, they're just bare bones figures.
The look of this is to have the opponents choose their attack, move forward toward their opponent, complete their attack and move back. Then the turn goes back to the other opponent.
Here are the variables in the create event of the battle controller:
Code:
//these determine which opponent is attacking. The player is set to true for testing purposes before I implement the initiative system
global.player_turn = true;
global.enemy_turn = false;
//enum for player state machine
enum player_combat {
ready,
attack,
magic, //not used yet
run //not used yet
}
//enum for enemy state machine
enum enemy_combat {
ready,
attack,
magic, //not used yet
run //not used yet
}
//the distance the player and enemy will move forward and back once they complete their attack
player_x = 30;
enemy_x = 30;
//beginning enemy and player state
p_state = player_combat.ready;
e_state = player_combat.ready;
//counter used for enemy to make their turn
e_counter = 0;
e_count_begin = false;
Code:
switch (p_state){
case player_combat.ready:
//determines if it is the player's turn and can move forward with combat
if(global.player_turn == true) && (global.enemy_turn == false){
p_state = player_combat.attack;
}
break;
case player_combat.attack:
//once the player is in the attack state they move forward signifying they attacked
//then alarm 0
if(keyboard_check_pressed(vk_enter)){
obj_player.x += player_x;
global.player_turn = false;
alarm[0] = 60;
}
break;
}
//the same applies to the enemy
switch (e_state){
case enemy_combat.ready:
if(global.enemy_turn == true) && (global.player_turn == false){
e_state = enemy_combat.attack;
}
break;
case enemy_combat.attack:
if(e_count_begin == true){
e_counter++
}
if(e_counter >= 60){
e_count_begin = false;
e_counter = 0;
obj_enemy.x -= enemy_x;
global.enemy_turn = false;
alarm[1] = 60;
}
break;
}
Code:
//ALARM 0
//once the alarm completes the player returns to their original x origin and then the player's turn ends and the opponent's begins.
obj_player.x -= player_x;
p_state = player_combat.ready;
global.enemy_turn = true;
e_count_begin = true;
//ALARM 1
//same as above
obj_enemy.x += enemy_x;
e_state = enemy_combat.ready;
global.player_turn = true;
Tell me what you think, if this is something that interests you at all, and if you have any ideas on how to improve the very, VERY, basics of this system so far.