...create TowerDefense (aim Enemys)?

0 favourites
  • 10 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hello and sorry about my english!

    I try to make an TowerDefense Game - yes, i know it's hard and Pong would be easier *hehe*

    I make a lot of things for these game what works fine for me (buying diffent types of towers, upgrading towers, sell towers, path-finding for enemys,...), but there's one thing i'm not able to accomplish:

    AIM ENEMYS!

    HERE you can see a test (HTML5) and HERE you can download the .capx file

    (includes only the most necessary objects)

    My problem/question: why does the tower loose the target to the enemy he already shot, BEFORE the distance is more then (in this example) 128px?

    I already tried out the turrets-addon, but i also don't get fixed it... :(

    Thanks very much!

  • You are always targeting the closest enemy with 'pick nearest to tower' event.

    If you wish to change it to something else you could do it like this:

    Tower defense demo

    Not the most elegant way, but you'll get the idea :)

  • Thanks - works fine!

    But is it possible, that it also works with "familys", so i don't have to create a lot of events for each kind of tower and enemy?

  • Thanks - works fine!

    But is it possible, that it also works with "familys", so i don't have to create a lot of events for each kind of tower and enemy?

    Sure, just replace the 'tower01' or 'enemy' parts with corresponding family and it should work just fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • And whats with the instance variables? Have i also change it to family-variables?

  • And whats with the instance variables? Have i also change it to family-variables?

    Yup, otherwise you cannot access them when referencing an object through family.

  • Ok, i get it - thank you very very very much!!!

    The community and the people here are so great!!!

    But now i have another problem :(

    The distance is (in our case) 128px - but how do i realize it when i have diffent towers with different ranges?

    So tower1 have 128px, tower2 196px, tower3 256px,...

    And when i upgrade an tower his range also increases...

  • Ok, i get it - thank you very very very much!!!

    The community and the people here are so great!!!

    But now i have another problem :(

    The distance is (in our case) 128px - but how do i realize it when i have diffent towers with different ranges?

    So tower1 have 128px, tower2 196px, tower3 256px,...

    And when i upgrade an tower his range also increases...

    Create another family variable, range, in your tower family so all your tower types will have it. Now you can define the range for every tower type individually. You can refer to it via familyName.range in the events (range check in this case)

  • It works absolutly great - very very very big thanks!

    But i have another problem...

    (sorry)

    When i build a tower near at the end of the road and an enemy reaches the end (out of screen - there he will be destroyed), the tower does not react anymore... As the thought "Hu... Where is he?!"

  • Edit: i get it ;)

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