Rts targeting

0 favourites
  • 4 posts
From the Asset Store
10 isometric and animated Strategy Game Buildings in two Colors.
  • Hello.

    I am trying to make an RTS game, but i am having some major issues with regards to targeting. I have tanks that consist of 2 sprites: A tank body and tank turret. Blue tanks are yours and red tanks are enemies (though for now red tanks do not function other than to be targeted, take damage if so and then be destroyed if its health reaches zero).

    I need the blue tank to be able to auto target red tanks that are in range. But i also want to manually target an enemy by right clicking it. I need this manual target to override the auto target, but i am at wits end as to how to figure this out.

    Another problem is that i want the selected target to switch to an animation called targeted (shows a targeting reticle over the tank) while the blue tank is selected (selected = true), the blue tank is targeting (targeting = true) and the red tank in question is targeted (targeted = true). This works fine on the blue tank's side, but not the red tank! All the enemy red tanks are switched to targeted instead of the specific one. How do i make it target the specific one?

    I also require the projectile to ignore untargeted tanks, going through them to hit the targeted ones. Which is difficult when all of them get selected to targeted. I think I already have this down but I'm just putting it out there

    Sorry bout the wall of text. If your answer is better than my targeting system feel free to suggest it. Also im using the free version of construct 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • with boolean true and false..when mouse is over red target make the blue tank false ..under the true make sure whata ction you have to stop attack the red tank....

    for second question you need to make UID to and globals to wath what tank tou have target etc..

    is hard to tell you correct your problem cause there alot combex and trick event and action ...k with out capx we cant tell you the correct answer with word's

  • #CBelle need to know how to post cap x!!!! the only advice i can find is to ask a moderator... and no link

    #Sandvich 725 I tested this out, guessing you are using the rts example, my first advice is add a keyboard object, and have:

    T is down, right mouse button clicked, cursor is over "enemybase/blue" event

    (ok not fully tested, but the right click function is already taken, and can mess with the example code for moving so on other right click events, u may have to add an additional inverted(T is down)...mostly as it has a new move to function)

    create a new sprite, like a targeting sprite, with pin behavior.

    on click (Tis down etc) spawn targeting sprite to object enemybase/blue

    "targeting" on created pin to enemy base

    then add friendly base turret acquire target "targeting"

    make sure the "targeting sprite is destroyed when the tank is, else the friendly turrets seem to just pick the spot the "targeting" sprite remains at

    hope this helps, again, how do i upload cap x!!!! I'd bother to test everything if i didn't have to re write code in text

  • Ah i think i finally figured out how to add CapX links to this forum's posts. This should be it.Be warned though. It is a bit messy and might take a little while to figure out the code.

    Focus on the parts under the Blu_Tank and Red_Tank headings. The Blu_Rocket_Tank stuff is irrelevant right now. Also remember that only the Blu tanks are to be controlled.

    EDIT: Whoops... i need 250 rep... IDK what to do now...

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