Tower defence game, Tower spawn problem...

Get help using Construct 2

Post » Mon Jul 27, 2015 7:15 am

Im working on a Tower Defence prototype, and i have a sistem where you click on the empty field, select the name of the tower you want to create, and than your tower should sucessfully spawn.

but when i add more places where you can build your towers.
this happends:
Image
After a lot of try and error i created this line of events for this to happend.
Image
But aint worked.
This zone its giving me a headache:
Image

I want that the spawn of the tower and the "plate" (decorative metal stuff) only happend on one unique tower (preferably the one im actually clicking) I really beg you to help me with this.
i tried a lot of things but aint worked... D:

By the way if any of you speaks spanish, let me know, i would love to meet someone that speaks spanish and actually knows about construct.
B
5
S
1
Posts: 28
Reputation: 489

Post » Mon Jul 27, 2015 11:14 am

This is a common picking problem. Whenever you experience something like that, you can in 99.9% cases if not 100% be certain that its due to a picking issue :)

In event 9 you are using a "Place" to spawn a plating object, but you haven't picked a "Place". So C2 doesn't know which "Place" you are talking about and therefore it assumes that all "Place" objects are valid and therefore picks all of them.

If you add the following to event 9 and 10:
Mouse is over "Place"
Pick nearest "Place" to Mouse.X and Mouse.Y

It should solve the problem. However whether that is the best solution im not sure, just an example of how to solve it, with correct picking.
Also you are using a newly created "Plating" in event 9 to spawn a "Dial Shooter", im pretty sure this is going to cause problems, if it wasn't for the wait. So I I were you I would change it so you are also using the "Place" to spawn the Dialshooter or use the System->Create object instead. The same goes in Event 10 with the "Cancel" that way you can get rid of the "Wait". which is rarely a good idea to use in my opinion if it can be avoided.
B
45
S
12
G
3
Posts: 1,210
Reputation: 7,559

Post » Mon Jul 27, 2015 3:56 pm

Thank you very much nimos100! but, how do you use the "pick nearest" event, i cant find it.
B
5
S
1
Posts: 28
Reputation: 489

Post » Mon Jul 27, 2015 4:01 pm

You find it for each object. So in your case it would be in your "Place" object under the section Size & Position, its actually a dual function called "Pick nearest/furthest". But the only reason to use it in this example is to avoid picking more than one "Place" in case they are so close to each other that the mouse cursor can overlap more than one "Place" at the time.
B
45
S
12
G
3
Posts: 1,210
Reputation: 7,559

Post » Mon Jul 27, 2015 5:16 pm

nimos100 wrote:You find it for each object. So in your case it would be in your "Place" object under the section Size & Position, its actually a dual function called "Pick nearest/furthest". But the only reason to use it in this example is to avoid picking more than one "Place" in case they are so close to each other that the mouse cursor can overlap more than one "Place" at the time.


Thank you very much.
B
5
S
1
Posts: 28
Reputation: 489


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest