Tower Defense

Get help using Construct 2

Post » Tue Dec 25, 2012 7:44 am

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
B
14
S
3
G
4
Posts: 24
Reputation: 2,673

Post » Tue Dec 25, 2012 9:10 am

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
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Tue Dec 25, 2012 9:39 am

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.vivekdx2012-12-25 09:40:59
B
14
S
3
G
4
Posts: 24
Reputation: 2,673

Post » Wed Dec 26, 2012 5:04 am

Still now i have some trouble in making Drag and drop method?
Any clear ideas???
B
14
S
3
G
4
Posts: 24
Reputation: 2,673

Post » Thu Jan 03, 2013 2:40 pm

[QUOTE=jayderyu]
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

[/QUOTE]

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?
B
3
Posts: 7
Reputation: 389

Post » Tue Apr 09, 2013 10:03 pm

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
B
15
S
5
G
3
Posts: 35
Reputation: 3,922

Post » Tue Apr 09, 2013 10:46 pm

@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.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Tue Apr 09, 2013 10:49 pm

[QUOTE=lukedirago]
@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[/QUOTE]

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.

[QUOTE=lukedirago]
So I'm trying to make a condition, to only place the turret if is overlapping a sprite.
[/QUOTE]
ok awesome. so the sprite puts down when on a allowed sprite.


[QUOTE=lukedirago]
It works, with the exception that if it's not overlapping, just leaves the DD icon everywhere else, you know what I mean?
[/QUOTE]
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.



[QUOTE=lukedirago]
Maybe there's a more logical solution to this. I hope you can share if that's the case :D
[/QUOTE]
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.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Tue Apr 09, 2013 11:55 pm

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.



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

Luke
B
15
S
5
G
3
Posts: 35
Reputation: 3,922

Post » Wed Apr 10, 2013 4:32 pm

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
B
15
S
5
G
3
Posts: 35
Reputation: 3,922

Next

Return to How do I....?

Who is online

Users browsing this forum: Colludium and 28 guests