djohoe28's Forum Posts

  • 11 posts
  • Using the pick nth instance with Sprite.count-1 should do it.

    Sorry, I forgot to write back - thank you very much, that's -just- what I needed

  • I found a relatively relevant answer - scirra.com/forum/pick-last-instance_t69019 but it still didn't solve it for me.

    Very basically I'm making a "visual array" of a certain sprite and I need the location of the last created instance of the sprite to do it, pretty much.

    Please and thank you, and of course, if this belongs in Beginner's Question, go ahead and move it

  • The solution is in here somewhere

    I tried increasing the cell size & border, and changed the origin, and still no luck

  • For the record, I based my project off of the included Turret Defense example.

    So there are Enemy Spawners, and every decreasing amount of time they spawn 6 enemies in a circle around them. Those enemies then Pathfind their way to the Player Core - whatever enters their Turret behavior's range stops them and makes them attack it.

    Now, after many trials and tribulations, I managed to do that, with one problem - enemies don't push other enemies around. They're solid. They have physics. The Turrets push each other around, so why can't the enemies?

    Here's the (probably) relevant piece of code.

    My guess is that the Enemy Pathfinding overrides everything else once it sets a path maybe? I dunno.

    -J.

  • frameAngle.capx

    Works perfectly! All of the thanks!!

  • Hey there!

    I want to make a Pokemon-Top-Down-looking Turret using pre-made sprites for each 45 degree angle of it turning - how do I make it so the object stays "static" (in place) while it's Turret behavior points towards it's Target?

    Example: (red block is Turret, dark red triangle is Enemy, black ring around Turret is it's Range)

  • Okay, now that i really see and know what you wanted to do.

    (i did't get that the enemys are turrents)

    Here is a capX;

    https://drive.google.com/open?id=0B1SSu ... GJuV3BxNU0

    I, ofcours, did't workout the whole gamelogic. Left mouse destroys a building. Right mouse adds a building and a enemy. That should simulate the gamelogic enough.

    'sprite' can be a family, needed in your case.

    Thank you, thank you, THANK YOU!! This is -absolutely- what I wanted - thank you very much!!

  • Absolutely thank you for all of your help - thank you for figuring out what I meant, that was exactly it

    I'm sorry to trouble you again, but could you help me with this part?

    Now for the next turret. The only que you have is the destroyed turret.

    So you need an event 'on TurrentObj' destroyd. Now the wrong turrent is picked. You want the next one. Call a function with as param(0) = TurrentObj.X and param(1) = TurrentObj.Y.

    A function will start picking from scratch. In the 'on function event'. You make a subevent: system pick by comparisation. Object = family. Expression = distance(param(0),param(1),family.x,family.y). Value = 60 (whatever is good for you). This combined with a TurrentObj, pick nearest x= param(0) y = param(1)

    I want the enemies to go towards whatever tower is nearest - regardless of if it's within "range" - right now, when the last turret "within range" is destroyed, they go to where it died, and just stay there - how do I make them go towards whatever tower is nearest?

    For posterity's sake, here's a relevant image:

    I feel so silly - I'm usually a very competent programmer

    Edit: The bottom event (Is Pathfinding moving along path) is my attempt at the range thing. It stops ALL the enemies on-screen once one has a target... I'm working on it, but I'd appreciate a little help... Apparently I should have moved this to "Beginner Questions"

  • Do you have acces to families ?

    Yup! Personal edition

  • Could you expand on this?

    first pick the family by UID using the Turret Behavior's TargetUID, and try to pick one of the object with same UID.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey there!

    I looked up help in Google and this very forum, and didn't quite find what I was looking for.

    Basically what I'm trying to do is similar to many MOBAs' minion behavior - I need spawned enemies to target the closest turret/core, pathfind their way there, and start attacking once in range. Once the target is destroyed - move on to the next closest turret/core, repeat until death.

    The attacking once in range is pretty easy, obviously, but I need help transferring the target picked by the built-in Turret behavior to the built-in Pathfinding behavior - probably using the Turret behavior's TargetUID - but how can I tell the cooridinates of the targeted object, especially when I don't know it's type - turret, of which there are at least 2 types, and the core?

    Please help,

    xoxo,

    J.

  • 11 posts