Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by tharshan09

Hi,

Does anyone have any source code or pointers of how to build a tower defence game? I have assets for the game but I am having trouble getting started.

Cheers.

1 decade ago by anthony

I don't have any source code but if you break down the requirements of what you need in order to build a tower defence game you'll be able to get started.

For example:

All tower defence games have a map / level and a base to defend.

A key part of these games is positioning of elements on that map, typically the Player clicks on a icon for the weapon they want to place and then they click on a location on the map where they want to place that item. Some areas of the map are available and other areas will be out of bounds.

The weapons placed on the map have different abilities and attributes - size, health, rate of fire, damage etc.

Tower Defence games need enemies to defeat. They have to spawn somewhere on the map and they have to be able to move towards a target. They can vary in size, speed, health etc.

Your weapons may need to be able to fire bullets at these enemies as they move - this requires spawning bullets, collision detection and maybe some basic maths to rotate turrets to face enemies / fire a bullet in their direction.

You need collision detection between the base and enemies / enemy bullets, the ability to end the game once the base has been destroyed or to move on to the next level once all the enemies have been killed.

I have never built a TD game but I've played a few they can become quite complex quickly. I'd recommend you start with the very basic elements of the gameplay and then increase the complexity - different types of weapons, different enemies, the ability to remove or repair a weapon once you've placed it on the map etc.

1 decade ago by mimik

I have a old messy prototype that you can do what you want with.
Was using +8month back impactjs so you might get some errors importing your version.

http://morgondag.nu/uploads/td.zip
I would advice you to split the code up, clean it and make it more modular.

1 decade ago by dungeonmaster

I'm also working on a TD project. Although it seems quite easy, with all the menus and upgrades and mechanic it really is quite a large project.

My advice is to start really really small. Take one simple TD game (like baloon defense I) and try to make the exact copy of it. Just change the assists with your own and volia.

I took Tower Defense as my game to copy but it also proved quite hard. I had to slash a lot of game elements.
Page 1 of 1
« first « previous next › last »