Jump to content


Photo
* * * * * 3 votes

Tower Defense Game Tutorial


  • Please log in to reply
111 replies to this topic

#1 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 06 April 2008 - 06:33 PM

Replies to topics in this forum are held to a high standard. Reviews must have a critique or suggestion for use to be approved. Read the rules here.

This is a new version


  • Tower Defense Game Tutorial
  • A full tutorial for basic TD games
  • Can be GM 6 or 7
  • Lite is okay, but pro is better
  • The file is a .zip file
  • Posted Image text link
  • 0.64 MB
  • To use this tutorial, you need some experience with GML, particularly about instances. The file is a zipped file containing a Word document and four editable example files.

Some time ago, I made the TD game Interceptor. After that, I got some questions about how I made it. That inspired me to make a tutorial about TD games. And this is it: I'll explain you how to make the key components for a well-working TD game. There are also some codes you can copy to your own GM file. If you have finished the tutorial, you have a game consisting of two towers, enemies following a path, a tower building system and a wave system, which could be a very nice TD game if it was a little better. Don't expect a full Onslaught clone :P , but it can still lead to great results.


Good luck!

Edited by athanatos, 10 October 2008 - 07:25 AM.

  • 1

#2 Baily

Baily

    GMC Member

  • New Member
  • 218 posts

Posted 09 April 2008 - 01:11 AM

Wow! Clearly you know how to make a tutorial! The Word Document is always a nice touch, and the system is awesome! 10/10! But one problem though, is that it's pretty hard to put into another game.
  • 0

#3 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 10 April 2008 - 09:29 PM

Has anyone read the lightning tutorial yet? I have, and it looks pretty good. Maybe you can use it in your TD game for your own towers. <_<
  • 0

#4 @Alex@

@Alex@

    GMC Member

  • GMC Member
  • 4336 posts
  • Version:Unknown

Posted 12 April 2008 - 01:46 PM

good tut, the varibles could be set in code as it seems alot was D&D, i may just use this.
  • 0

#5 smartgenius

smartgenius

    GMC Member

  • New Member
  • 46 posts

Posted 13 April 2008 - 06:30 PM

Good tutorial! The word document is great. You should probably start commenting where all the codes go though, I kept accidentally putting codes that were supposed to go into the draw event into the step event.
  • 0

#6 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 14 April 2008 - 09:25 PM

ATTENTION:
The Word-document and the fourth file have been changed. I changed the wave system; now it uses arrays in the system. That will make the game probably better for players in higher levels.

  • 0

#7 joshuarobillos

joshuarobillos

    GMC Member

  • GMC Member
  • 195 posts
  • Version:GM:Studio

Posted 16 April 2008 - 08:03 AM

Well using your click and place turret skills, i can put that and use it into my rts game! ty
  • 0

#8 da man7

da man7

    GMC Member

  • New Member
  • 16 posts

Posted 16 April 2008 - 09:49 AM

Great tutorial! this is one of the best I have ever seen! 10/10!!
  • 0

#9 Supertramp

Supertramp

    GMC Member

  • GMC Member
  • 353 posts

Posted 18 April 2008 - 12:06 PM

you could add an upgrade system to this to make it even better.
one thing- it doesnt say the price of the tower before you buy it
  • 0

#10 LimmingKenny

LimmingKenny

    GMC Member

  • New Member
  • 422 posts

Posted 19 April 2008 - 07:19 PM

The way the game is right now, it gets impossible to win around wave 68:
Posted Image
  • 0

#11 ssbtoday

ssbtoday

    GMC Member

  • New Member
  • 72 posts

Posted 19 April 2008 - 07:54 PM

make it so when you press space that it will set the wave time zero 0 and send the next round
  • 0

#12 2936hm

2936hm

    GMC Member

  • New Member
  • 63 posts

Posted 20 April 2008 - 02:14 PM

May you tell me how to set the 'just created' instance to follow the path and set a specific health??
I don't want to have a game crowded with different same object.
But anyway, your tutorial is great. It tells amost all things you need in a td. Well Done. 10/10
  • 0

#13 dark waffle

dark waffle

    GMC Member

  • New Member
  • 47 posts

Posted 20 April 2008 - 05:32 PM

is it posibble to make an enemy that will randomly spwan with the red enemys but no as much?

i want a enemy that will shoot at the turrets but only 2 or 3 appear in 1 wave
  • 0

#14 abecedariandude

abecedariandude

    GMC Member

  • New Member
  • 511 posts

Posted 22 April 2008 - 12:09 PM

I'm making a TD game right now. Awesome. This is just what I need. And with an easy and readable word doc! Gud job! <_<

Could you make it have a number of rounds? Like levels? That would be awesome. This is just wat i need by the way. Good Job!
  • 0

#15 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 28 April 2008 - 08:31 AM

is it posibble to make an enemy that will randomly spwan with the red enemys but no as much?

i want a enemy that will shoot at the turrets but only 2 or 3 appear in 1 wave


Well you could try to add this to the code of the wave system. Erase the part from the comment:
//Check the wave time and calculate how many enemies should be created
//Create the arrays for the next wave.
until the line
wave_enemies[e] -= 1; }}}}
The brackets are not like that, remember!
But first make a second enemy (that will shoot at the turrets) called ob_enemy2.
//Check the wave time and calculate how many enemies should be created
	//Create the arrays for the next wave
	globalvar ee,extra;
	if wave_time[wave] = 600
	{
		wave += 1;
		wave_time[wave] = 0;
		wave_enemies[wave] = 5+floor(wave*0.4);
		ee[wave] = wave_enemies[wave];
		extra[wave] = round(random(2))+1;
	}
	//Create enemies if needed for every array
	for (e = 0; e < wave+1; e += 1)
	{
		if wave_time[e] < 600 wave_time[e] += 1;
		if wave_enemies[e] > 0
		{
			if wave_time[e] = (ee[e]-wave_enemies[e])*15+15
			{
				if extra[wave] > 0
				{
					instance_create(-32,0,ob_enemy2);
					extra[wave] -= 1;
				}
				else
				instance_create(-32,0,ob_enemy);
				wave_enemies[e] -= 1;
			}
		}   
	}
}
It may not seem very different, but there are a few things different here: there is a new variable extra (which also works with arrays), and this works nearly the same as the variable wave_enemies, but it indicates the amount of ob_enemy2 that has to be created.
If you've added this, the system will randomly create 1,2 or 3 new enemies, using the variable extra, without making the total amount of created enemies different.
I hope this solves your problem. Else, tell me :(
  • 0

#16 giggdaw

giggdaw

    GMC Member

  • New Member
  • 38 posts

Posted 01 May 2008 - 11:10 AM

Yeah, this is probably the best tutorial ever seen xD
A few things mentioned before would be good, like the upgrade system and showing the price of towers when mouse hovers over it. And there should be more towers.
But to everyone... This is a tutorial, not a full game. He shows the basics, you figure out the rest. :D
  • 0

#17 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 03 May 2008 - 12:13 PM

This is an awesome tutorial!! Just one thing, is is possible to cancel building a tower. eg i press the button to build tower 1 but then i change my mind and dont want to build that tower. Is there a cancel button?

by the way I got to lvl 70

Posted Image
  • 0

#18 SONIC_LUIGI15

SONIC_LUIGI15

    GMC Member

  • New Member
  • 2 posts

Posted 03 May 2008 - 12:44 PM

I am having trouble adding new towers and there buttons.

Great tutorial! 10/10. I love Tower defense!
  • 0

#19 frog

frog

    GMC Member

  • New Member
  • 228 posts

Posted 11 May 2008 - 06:19 PM

i got to wave 70 too

Posted Image

and very nice tutorial just a shame it isnt completly in gml
  • 0

#20 fergyvivapinata

fergyvivapinata

    GMC Member

  • New Member
  • 98 posts

Posted 20 May 2008 - 02:11 AM

very nice one :( i also edited the game but gonna give credit, i added these things
rocket tower
freeze tower
sound tower
light tower
two player towers
music

thats it so far
  • 0

#21 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 20 May 2008 - 03:00 PM

very nice one :) i also edited the game but gonna give credit, i added these things
rocket tower
freeze tower
sound tower
light tower
two player towers
music

thats it so far


Ok very good! Tell me when it's finished, I'm surely going to play it :GM072: .
  • 0

#22 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 09 October 2008 - 06:50 PM

OK people: this is a new version with an upgrade system. Hope you like it!
  • 0

#23 KymcoCobran

KymcoCobran

    GMC Member

  • New Member
  • 329 posts

Posted 09 October 2008 - 08:04 PM

were is the link ?

Edited by KymcoCobran, 09 October 2008 - 08:04 PM.

  • 0

#24 Chronic

Chronic

    Administrator

  • Global Moderators
  • 2729 posts
  • Version:GM:Studio

Posted 09 October 2008 - 08:15 PM

The link is there but host-a.net is down or something so the image link isn't showing up.
  • 0

#25 athanatos

athanatos

    GMC Member

  • New Member
  • 25 posts

Posted 10 October 2008 - 07:26 AM

Yes, I guess that was the problem. But now it works again.
  • 0

#26 ArchDD

ArchDD

    GMC Member

  • New Member
  • 11 posts

Posted 20 November 2008 - 07:33 PM

rly nice 10/10
that helped alot dude!
i never had so much fun playing a example before lol
got up to wave 170 with all red lasers at lvl5
  • 0

#27 the sivart

the sivart

    GMC Member

  • GMC Member
  • 150 posts
  • Version:GM:Studio

Posted 21 November 2008 - 03:00 AM

sweet ;)
  • 0

#28 Slickdc

Slickdc

    GMC Member

  • New Member
  • 176 posts
  • Version:GM:HTML5

Posted 03 December 2008 - 01:44 AM

Is it O.K if I use some of these codes (Altered a bit) in a game that I might sell if I put you (athanatos) in the credits?
  • 0

#29 Potado

Potado

    GMC Member

  • New Member
  • 401 posts

Posted 03 December 2008 - 03:26 AM

there is no gm6 version!
  • 0

#30 ninootju

ninootju

    GMC Member

  • Validating
  • 81 posts

Posted 26 December 2008 - 12:22 PM

Thanks for this wonderful tutorial!

I have one question; I just made some more towers, but whenever I try to click on the placed tower (to open the little menu, to upgrade / sell them), the menu doesn't show up, but the circle around the tower does.

What's the problem with this?

Edited by ninootju, 26 December 2008 - 12:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users