Tower Defense

0 favourites
  • 12 posts
From the Asset Store
Tower stacker
$9.99 USD
Template for a tower stacker game, fully documented in comments and video
  • Hi friends,

    Merry Christmas to all....

    I am new to Construct 2. Learning to get the functions for some games.   

    I am planning to make a tower defense game somewhat like plant vs zombies or empire vs orcs.

    I made a layout with some objects but damn i am struct how to make some fight or how to use that drag and drop feature like that and also i have no idea how to randomly make the enemy to pop out from any of the four lanes.

    Some one please make a tutorial for me in my file. I can understand and try to make my own next time.

    My File

  • Well for the random of locations try this. Use the thoery base and not literal.

    Create sprites to be spawn locations. These should be the same sprite, but instances. ie copy and paste or created at specific lcoations

    on every X seconds

    ->system.pick instance spawnsprite object, random(0, spawnSprite.count)

    ->create monster (layer, X=spawnSprite.x, Y=spawnSprite.y)

    ----

    for Drag and Drop towers and stuff

    create a row of Icons(which you probably have)

    create a Drag and Drop Tower for each icon(as you probably have)

    put the D&D towers over the icons and set to invisible

    on MouseDown on D&DTower

    set D&D Tower to visible

    on Release of Mouse

    check to validate tower position

    if true

    -> create game play tower at XY location

    ->set D&DTower invisible

    ->set D&DTower position to ojbect(icon)

    -----------------

    as for fighting

    here is my suggestion

    put a invisible sprite sensor over each tower(this is the range)

    for each enemy

    collision with sensor

    -> rotate tower(that belongs to the sensor) towards angle(tower, enemy)

    ->check angle change. If angle change = 0. Shoot

    sorry that I'm not going to do a tutorial. but doing this is most of the core game play. I'll help people to get on the right track, but not one to make the game for them :D

  • Thanks man its enough i can make it to work in few turns

    Just thinking how to make drag and drop object without moving the content in that menu.

  • Still now i have some trouble in making Drag and drop method?

    Any clear ideas???

  • as for fighting

    here is my suggestion

    put a invisible sprite sensor over each tower(this is the range)

    for each enemy

    collision with sensor

    -> rotate tower(that belongs to the sensor) towards angle(tower, enemy)

    ->check angle change. If angle change = 0. Shoot

    Hi Jayderu

    I'm also trying to build a game like this. Could you explain more about how to make the sensor belong to a tower?

  • Hello! This is my very very first question here, so sorry if it's too n00b ;)

    I've beginning using C2 a week ago, mainly to make a prototype of a game, but now I'm finding it robust enough to make it entirely here.

    It's a basic Tower Defense game.

    So, I've progressed a lot using the turret example and behaviors, but I'm starting to need more. Like deployment of the turrets for example.

    jayderyu Your method of using drag & drop worked like a charm, but I'm trying to limit the area available of deploy. So I'm trying to make a condition, to only place the turret if is overlapping a sprite. It works, with the exception that if it's not overlapping, just leaves the DD icon everywhere else, you know what I mean? Maybe there's a more logical solution to this. I hope you can share if that's the case :D

    Thanks!

    Luke

  • lukedirago, tutorials are your friend! Mine in particular: it covers everything from placement of turrets to generating waves of enemies.

    It's pretty basic, but it should set you on the right path.

    Wow, this thread is old.

  • jayderyu Your method of using drag & drop worked like a charm, but I'm trying to limit the area available of deploy. So I'm trying to make a condition, to only place the turret if is overlapping a sprite. It works, with the exception that if it's not overlapping, just leaves the DD icon everywhere else, you know what I mean? Maybe there's a more logical solution to this. I hope you can share if that's the case :D

    Thanks!

    Luke

    Let me break this down into parts as I seemed to not convey what I was trying to get across last time about this part.

    So I'm trying to make a condition, to only place the turret if is overlapping a sprite.

    ok awesome. so the sprite puts down when on a allowed sprite.

    It works, with the exception that if it's not overlapping, just leaves the DD icon everywhere else, you know what I mean?

    No. I don't know what you entirely mean. What I'm reading is that if you try to let go of the DD object on a nonsuccess point. The DD icon is left somewhere. Where is it being left. Are you destroying the Icon upon release and failure to put down.

    Maybe there's a more logical solution to this. I hope you can share if that's the case :D

    If I can I will.

    Mouse.OnDown

    -> Is Mouse overlapping TowerIcon

    --> Create Icon

    While.OnDown

    -> TowerIcon.XY = MouseXY

    Mouse.OnRelease

    -> Is Icon Overlapping DeployAreaSprite

    --> Create Tower DeployAreaSpriteXY... bleah settings

    -> Else(ie not overlapping)

    --> Destroy Icon

    Past this. I'm not sure where I can help. You can share you CAPX, but I'm using the last stable release 119. You can share a picture of your event code also.

  • Hi! Thanks for the quick reply!

    I've come to a solution in the meantime, but again, I don't know if it's the most efective one. Here it is.

    <img src="http://img198.imageshack.us/img198/3910/soldierdeploy.png" border="0" />

    Thanks again! I'm sure I'm gonna bother you again with something really soon hahahaha ;)

    Luke

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Geometrix!

    Thanks for the tutorial, for some reason I missed it yesterday when you replied.

    It looks great, I'm gonna have a look right now ;)

    Thanks!

    Luke

  • GeometriX YOu may need to fix the URL in your signature, this is what I get when I click, on it:

    scirra.com/FORUM/%22http://www.scirra.com/tutorials/443/building-a-tower-defence-game-with-the-turret-behaviour%22

    It looks like it is sticking %22 before and after your link which I believe are either brackets or spaces. Make sure there are no extra characters or trailing/leading spaces in your URL. I had the same issue with mine. The Insert link buttons on the site tend to insert a space between brackets, etc..

  • BluePhaze, thanks for pointing that out. Weird, I tested it when I first put that link there and it worked fine.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)