Speedy1SonicBoy's Forum Posts

  • You can use Timer behavior. Or increase a variable every 1 second, and check if it's >=5 seconds.

    For this... I might also need another example.

  • Say, you have a single Enemy sprite with animations Zombie, Skeleton and Goblin.

    Put 3 copies of this sprite on Assets layout. Configure the animation and instance variables like HP, armor etc. And give a name to each template:

    When you create an Enemy from "goblin" template, it will be created with the correct animation and variable values.

    Templates are not related in any way to animations. You can have multiple templates with the same animation, for example "zombie_soldier", "zombie_medic"

    I think I have it now.

    Thanks for the example, it really cleared things up. Now how do I trigger a spawning to a certain event OR a timeframe, say, of 5 sec of that event not happening?

  • I think you understood correctly. However, I myself am having trouble with understanding some of the context here. How can I implement templates in animations? Do I name the template the same as the animation?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have four different animations for a sprite. I had an idea to attach a variable number for each animation of an object to affect where they spawn in. Perhaps I'm looking at it the wrong way? Perhaps there's something else I can do instead?

  • This was made before you posted your last few posts but maybe you can get some ideas from it.

    Roughly it just creates attachment points around all the attached objects, and then deletes invalid points that overlap other attached objects.

    It keeps track of what's attached with a boolean variable and doesn't let moving objects get attached so you can throw them. Also it keeps track of the order the objects are added with a number variable.

    https://www.dropbox.com/scl/fi/7vf4eia7vzvmnzd8hoi6g/dynamic_attaching.capx?rlkey=gjl65ke9vjpj0nqsz42im1fq5&st=niaagaur

    Well, that's huge, to say the least. Thank you! I'll take a look into it and see what I can reverse engineer!

  • I've gotten closer to what I want now but it's not 100% just yet.

    Below is an example of my code:

    And this is what's happening:

    The Sprite 2 is now just a little too close to/far from Sprite 1 anchor to make a stable shape, and the other instances sometimes overlap. Also, upon Space being pressed ALL instances have the bullet reaction instead of just the one connected.

    Still, I consider the appearance of anchors on Sprite 2 a success over not having them before.

    I think I'm missing the 0/1 variables for those, but tell me, is there something else on top of that I might also be lacking?

  • So those are the images of the instance shapes. However, to reject with the space button...

    ...In the order in which it's collected, the Sprite 2 instances (Colored) will be thrown in the angle from which it is collected by Sprite 1 (in Black). This is so that the shape made can match with the plans shown above.

  • 28 total instances of Sprite 2 can be attached at once. So... the shape can get pretty big lol

    The before attach is as the first Construct image, and the after is something like the second. where I'd like for it to be able to attach is given by the orange dots of the next examples here:

    Anywhere along those orange dots, I'd like for instances of Sprite 2 to be able to attach to, such that they're diagonal from one another.

    As for the instance variables, I like that idea. Will keep you posted on whether it works or not, though, for some reason, it tends to require a reset lol.

  • Screenshots will be better, I think.

    What I have is basically like a top-down POV of the picture above, but the green one on the top right hovers with the rest of the form, and no other instances will collect.

    So Sprite 1 attaches to Sprite 2 at the anchor points like I wanted.

    What I want is for each Sprite 2 that's attached to then have anchors to attach to other Sprite 2s, but only when attached to Sprite 1. I'm thinking heirarchy and having children of Sprite 1 be Sprite 2 might solve the problem of in which order, but when I press Space I also want the Sprite 2s to shoot out and remake-available the anchors once present.

    The code so far is as follows:

    But I think I messed up towards the end with the Sprite2Anchors somehow. Is there any way I can keep the other ones attachable as well, such that the attached Sprite 2s can keep their positions?

  • I just realized that the YouTube link isn't working for me for some reason.

    Anyway, maybe this can help illustrate what I mean.

  • My idea has gone bust. Though the initial plan worked, the added complication, well... complicated things.

    I want to know how to add additional instances on anchor points of Sprite 2 attached to Sprite 1 without it jumping all over the place in confusion with itself.

    I don't know how else to explain it, other than that the resulting shape should be bigger. There's also the added idea of pressing space to immediately get rid of the sprite 2 that was just collected, making the overall shape one less than it was. That part I'm almost certain I have down, but angles are weird, too. I hope to reject the piece and it to bullet to the direction from whence it came. That seems like its own post, honestly, but do let me know.

  • Please post a screenshot of your code or the project file.

    Actually, *whew...* I got it to work! Thanks so much!

    Now the idea might just be to create more anchors for the Sprite 2s that are connected to Sprite 1, again such that they don't overlap. Thankfully, I think I might just know how to do this thanks to you!

  • Alternatively, if you want to do this with image points, you will have to loop through all image points, check which ones are unoccupied, and which one is the nearest to Sprite1 - the code for this will be pretty complicated.

    Based on my example off of what you said, I think the latter may be the best and more thorough option. I think it gives room for the second part to this as well, which you already gave me the idea on how to solve for with the former example.

    In any case, I must have done something wrong, because some weirdness is going on where the other instances aren't occupying any other anchors.

  • > Yes, your event may look something like this:

    >

    >

    >

    >

    > Origin image point has index 0. Image points 1-4 are for attaching instances of Sprite2.

    Nice!

    First point seems to work. But now having done this in an example project, all instances of Sprite 2 seem to point to the same point.

    Not what I was hoping for... Proximity to the points was the thing I was hoping to attract Sprite 2 to Sprite 1, so that by proxy each one would attach to each point. Could it be because I have all my versions of Sprite 2 in the same family and am referencing the family instead? Or is there something more?

    Maybe I'm complicating things a little lol

    My idea was to have an instance of Sprite 2 attach to whichever of the 4 points Sprite 1 has nearest it without the other instances of Sprite 2 taking its place. Mind you, I also have the instances of Sprite 2 in a family, and I think I made it harder for myself in doing that, but I'm yet not sure.

  • Yes, your event may look something like this:

    Origin image point has index 0. Image points 1-4 are for attaching instances of Sprite2.

    Nice!

    First point seems to work. But now having done this in an example project, all instances of Sprite 2 seem to point to the same point.

    Not what I was hoping for... Proximity to the points was the thing I was hoping to attract Sprite 2 to Sprite 1, so that by proxy each one would attach to each point. Could it be because I have all my versions of Sprite 2 in the same family and am referencing the family instead? Or is there something more?