Dice Game Progress

I've been working bit by bit on a dice game for my 2D scripting class. We work solely in Game Maker, in GML. Early in the course our class was broken down into a few groups and each group was given a package of dice and tasked with creating the framework for a dice game.

The group I was a part of decided after some discussion to go with a sort of tower defense game with one defender and many enemies. In fact here are the notes we came up with the framework for the game:

Castle Tower Defense (One [defender] against many [attackers])
Number of waves: easy (4), medium (7), hard (10)
X – 2 times the number of attackers - starting Buildings each getting a 2d6 roll
Buildings defense is the target roll with health at 100
Attacker rolls 1d6 to set number of units it attacks (y) with then rolls y dice to determine strength of
those units
Defense and strength determine number of dice to roll for that side.
If defense is > then defender takes no damage
If attacker is > then defender takes the difference in damage.

For the first week I had written up a ton of "pseudo code":

switch (difficulty){ easy: numwaves = 4; break; medium: numwaves = 7; break; hard: numwaves = 10; break; }
numbuildings = 2*attackers;

yy = 100;for (i = 0; i < numbuildings + 1; i +=1){instance_create(200,yy,building_obj);yy += 100;with (building_obj) { defense = 2*(irandom(5)+1);    }} numattackers = irandom(5)+1;for (i = 0; i < numattackers + 1; i +=1){instance_create(xxx,yyy,attacker_obj);with (attacker_obj) { strength = (irandom(5)+1);    }} if (combat) { for (i = 0; i < defense + 1; i += 1){ defend += (irandom(5)+1);} for (i = 0; i < strength + 1; i += 1) { attack += (irandom(5)+1); } if (defend > attack) { show_message(“Defender takes no damage!”); } else { damage = attack - defend; health -= damage; show_message(“The defender has taken “ + string(damage) + “ points worth of damage!”); } }

Since then I've managed to get the defenders buildings created with their defense, with each one having an appropriate roll to set their defense. The dice are displayed as I want them, with multiple variations on appearance, buildings have 4 different designs. I have two different attacking unit images, and I have the code in to create the attacking players. Now though I've reached the point of changing turns which is where I've been stuck for a bit. I'm using a ds_list for the attacking players but since I've never used ds_lists let alone like this, I'm having to do some research to figure it out. With everything else on my plate this hasn't gone as quickly as I'd like but I know that once I get this into place the rest should flow quickly.


Popular Posts