99Instances2Go's Forum Posts

  • Another solution based on size and families. This picks the nearest to the edges of the dragged sprite. You need families for this capX. Wich i usaly try to avoid in examples.

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

  • I have to add.

    If nearest is not just the nearest to a position, but nearest to the eachothers bounding boxes. Then you have to ray trace.

    This plugin is the easyst ray tracer arround.

  • I suppose you started with the 'pick nearest' condition. And then you encounterd 2 problems.

    1/ 'nearest' picks nearest to a position. The 'nearest' to the position of a sprite is the sprite itself.

    2/ What ever else you try to pick under a 'is dragged' condition, only the dragged one is picked. This is just natural, because the 'on dragged' picked that dragged sprite, and for all subconditions that follow, that pick is the Previous Picked Selected Object List. All following subconditions start picking from that Previous Picked Selected Object List. And that is the dragged one.

    To solve this, the easyst way is to use functions. Functions start picking from scratch. Always.

    Therefor, here is a capX that is based on 'pick the nearest'. Just the show you why it probaly not worked, and the solutions that can be used.

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

    But, as TwinBlazar mentioned, it can be easely done by building a distance map first. Here is an exemple of that.

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

    Yet you have to solve the same little problems. Lowest distance to a sprites position is the sprite itself. Pick others then those picked by the dragging condition is far way easyst done with functions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Will the enemys all start/stop moving at once, as they do now (with 1 global variable for all) ?

    Or, will they (in your gamelogic) start/stop moving when they have a personal reason to do so ?

    It is a differend approach.

    A reason could be, when they see the player .....

  • Not needed, i messed up in understanding the question.

  • AE can render to PNG sequences (channels = RGB + Alpha.). Any other format has no use, c2 will convert it to PNG.

    Meaning, for the little animations you are save. Dont forget the alpha channel.

    Keep in mind that images are usually actually held in memory in a power-of-two size (e.g. 128x128, 256x256, 512x512, etc).

    Best to respect that.

    For the background. I suggest you try. Trying dont hurt.

    Choose for a viewport that is not to big. Render in PNG sequence with NO alpha. It might help if you render at half the viewport and scale it in C2. You cant go for quality. Use a sprite, not a tiledbackground. Dissable colission for the sprite. Go for memory use and good load times. Try to do everything on 1 layer.

    I think you can not parallax this background animation. It will be way to big to handle.

    Its is not impossible, in my opion, for the background. But, yeah i can be wrong.

    Its the way to go for the small animations.

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

  • There is no collision happening. Auto is or outside curso or overlapping curso.

    Use 'is overlapping' instead of 'on collosion'.

    Or use a behaviour that knows collisions, like bullet, or physics, or car ......

    or ....

    You might want to define 'collision' as the moment one sprite = touching another one. That is only half the story.

    A 'collision' happens when there is a push-out-of-solids happening between 2 sprites.

    To add this to the custom movement. Forget the overlap and the collision conditions. Just make auto 'push out of solids' in an 'on every tick" condition, and auto wil stop automaticaly. You have to set curso to solid for this to work.

  • Okay, your question is: How do i make a turrent's target to find a path towards that turret, using the turret's target UID.

    Well, Bring all the objects that can be a target in 1 family.

    Set the turret to target that familie.

    Al you need now is an event with the condition: TurrentObj, on target acquired.

    Combined with a second conditon: family, pick by UID, UID = TurrentObj.Turret.TargetUID

    Now TurrentObj is picked and the family member with that UID is picked.

    So the action in that event .... family find path to x = TurrentObj.X, y = TurrentObj.Y will be adressed to the right TurrentObj and the right family member.

    I suppose you know how paths work, else plz read the manual.

    BUT. Knowing that is your question, i also know that is NOT what you want to do. A turret has only ONE target. If you spawn 100 nasty enemys arround the turrent, then only ONE will be a target. Until you realease it as target, until you move it out of range or until it is destoyed by a kill.

    Only that one enemy will find a path and run to the turret, because well, that is what you ask, and what i provided.

    What you ask as a result is that they all (all 100) run to the nearest (even when they are not a target) turrent and start shooting when the turret is in there range (has nothing to do with the range of the turret). And when that turret is destroyd, they have to run to the next nearest turret and start there blast on that one.

    So what you want is: all the events that you have allready in place to spawn nasty enemys.

    Then an event with the condition family/object 'on creation', can be the family. Combined with TurrentObj, pick nearest, X = family.X, Y=famely.Y.

    This picked the right enemy (the newly created one) and the right turrent (the nearest). The family, find path to X = TurrentObj.X and Y = TurrentObj.Y will send the right enemy to the right turret.

    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)

    Now all family members within a distance of 60 pixels of the destroyed turrent are picked and the nearest turrent is picked. Just make the path to find em.

    I am sure you can solve the range issue yourself.

    I hope you understand why there was no reaction before. The question could not be answerd in a way that also the wanted result was included.

  • Do you have acces to families ?

  • Added to my daily RSS collection. Time will tell.

  • Bring whats clickable to dedicated layer ? Filter out whats not on that layer after a click ?

  • Then make a global variable, or a instance variable on the player. And add 1 to it, in the same event.

    With the system based action 'add to' if you choose for a global variable.

    With the sprite based action 'add to' if you choose for an instance variable.