Tower defence game, Tower spawn problem...

  • 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:

    After a lot of try and error i created this line of events for this to happend.

    But aint worked.

    This zone its giving me a headache:

    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.

  • 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.

  • Thank you very much nimos100! but, how do you use the "pick nearest" event, i cant find it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

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