monitz87's Forum Posts

  • Cool, I'll have a play around with that later. Does the invisible sprite also need to have the main movement routines (eg I'm currently using MoveTo + Line of Sight to chase the player when they can see him), or can you assign those to the main sprite, and just leave the pinned invisible ones as Custom Movement with Solid enabled and it'll work itself out?

    My main problem in the past has been the way sprites sort of 'pop' around the place when pushing out of solids, especially when clumped - it just looks glitchy and bad. A lot of my game is also in very tight tunnels which makes it doubly hard to find something that works.

    As far as I know, you just have to pin the invisible sprite to your enemy sprite, you don't even have to use custom movement on it, it will just follow the enemy sprite around. But as DUTOIT suggested I'd rather not use the solid behavior and set the AI myself whenever the invisible sprites collide. That's doubly true if you're gonna have tunnels in your game, because if you set the force fields to solid, then the enemies might not fit into the tunnels, or bounce around a lot when they're traversing them. Also I'm not sure how it would work out if both your enemy sprite and the invisible one are solid.

  • I think what he means is pinning an invisible sprite to every enemy, and making that sprite have a bigger hitbox than the actual enemy sprite (the area which you don't want other enemies to enter). You should also place it in a container with the enemy. Then, whenever those sprites collide with something, you can do whatever your logic determines (such as making the enemies go away from each other and then continue to pursue the player), or if you want the easy way out you just give the invisible sprite the solid behavior.

    This way you achieve enemies never clipping with each other without actually having to affect their hitbox (which I assume you want unchanged for shooting them or whatever way you have of damaging/defeating them)

  • If your buttons are sprites you could try disabling collisions on them when the corresponding layer becomes invisible

  • define your own function which calculates the sign, you can call it in expressions with Function.Call("Sign", x)

  • YES!! IT WORKS!!!

    THANK YOU <3

  • The usual method for isometric or 3/4 view Z-sorting in C2 is to add everything you want sorted to a family and set up an event like this:

    For additional control, I like to add an instance variable to the family called elevation, and sort by IsoObject.Y+IsoObject.Elevation. That way I can change an object's sorting priority without changing it's position. Hopefully you can adapt that to suit your needs.

    Thanks, I'll try doing that. I'll calculate the Elevation prior to the sorting by using the X positions of the bullets relative to the Screens on the same tile. I'll tell you if it works out.

  • Hi, thank you for your reply

    How would that event look? I'm trying to picture it but can't

  • I forgot to mention that I'd rather not use hitboxes if possible, it should be a purely position-based algorithm

  • Hi everyone,

    I'm currently building a 3/4 perspective board game, and so far I'm having a LOT of trouble with the z-order. Normally it would be a breeze, but I've got a certain element of uncertainty in the game.

    As you can see, I've got these screens which make bullets bounce, and depending on where the bullet is coming from, the bullet should be either in front or behind the screen when they share a tile. I've tried a million different approaches to the z-ordering but every time there's a certain case where it doesn't work as intended.

    Does anyone know of a reliable algorithm to sort my sprites in the Z layer? As you can see, it's not a thing of just moving things with the highest Y to the top of the layer.

    Cheers

  • I'm not clear on what the advantage of the "alias" feature is over just putting object UIDs or IIDs in a local variable and using that to reference objects. It sounds like the name of the local variable would basically be the alias.

    I was suggesting it as syntactic sugar, if your Object has more than 5 or 6 instance variables and you wish to compare most of them between both objects in a collision, then it becomes a tangle of local variables and subevents that would be avoided if you could just have an actual reference to each object in the same condition block. A similar thing could be accomplished if Object references could be assigned to local variables, but I'm guessing there's a good reason why that isn't implemented either.

    [quote:14xf561p][quote:14xf561p]the engine could just as well support aliases by treating the SOL as an associative array.

    That would be disastrous for performance. Ordinary arrays are essential for strictly O(1) efficiency.

    If it's a performance issue then there isn't much to be done :c

    PS: Ashley, what about my other suggestion? About having combined AND/OR blocks?

  • Another godsend of a feature would be the possibility to combine "AND" and "OR" blocks within the same event. Something like

    Player.X > 10

    Player.Y > 10

    -or-

    Player.X < 20

    Player.Y < 20

    Where both the top conditions OR both the bottom conditions have to be true for the event to be triggered. Lack of this feature sometimes results in a lot of repeated actions and some clunky nested events scenarios that could be easily avoided

  • I just checked, and the object(index) is not re associated in the sol for the collision event. Perhaps that may be a bug? Ashley

    However I still don't see how naming an object would be useful as you are stuck using the same picking methods, at least at the local level that is.

    Maybe you could explain that a little more?

    The thing with System pick nth is that you can't differentiate both objects within the same set of conditions, so if you want to compare their instance variables, you have to store them in local variables, but if you also want to check for individual properties, you have to do it in separate sub-events.

    With aliases you should be able to do all those things within the same sub-event without having to rely on local variables, which in my opinion is a very good thing, because it helps to keep code more readable and less cluttered with unnecessary sub-events

  • Already exists

    You can pick "nth" in a collision and it will pick the index given if you use it in a subevent, with those indices being 0, or 1, not sure if you can have more than 2 objects in a collision.

    You can also reference objects by their index as sprite(index).thisvalue.

    Not 100% on if that works with collision tho....

    I know you can work around it with "System->Pick nth instance", but you have to use local variables to store whatever information you needed about one instance if you plan to compare it or combine it with the information stored in the other one. It's quite a hassle, and if I'm not mistaken, the engine could just as well support aliases by treating the SOL as an associative array.

  • Hi,

    I think the engine would benefit greatly from having this feature added. What do I mean by aliases?

    Well, whenever you are picking multiple instances of the same object (the most common example would be collisions), you should be able to name each one with an alias, which you can then use to distinguish them throughout sub-events.

    For example, the event sheet would say something like

    Bullet as Bullet1 on collision with Bullet as Bullet2

    And then in sub-events you could refer to each bullet by its alias instead of having to use "System -> pick nth instance" and using local variables.

    This could also mean that you could simply pick different instances of the same object in an event... Let's say for simplicity that I have a RankedPlayer Sprite object in my project which has several instances, with a 'rank' number instance variable which varies throughout the runtime, and on certain situations I wish to pick the player with the top rank and the player with the bottom rank and make them fight or whatever by moving both sprites to a certain location. Without aliases, if I were to put both those conditions on an event, the event would pick an empty set because no RankedPlayer has both the top and bottom rank. The way around it would be to use two events, picking both instances separately and moving them, which is not a big deal. But what if the location was determined by an instance variable on the bottom ranked player? Then it would be much more of a hassle, because once again I would have to resort to "System -> pick nth instance" and local variables. A simple way around it would be to have Aliases force the engine to pick different instances, making it possible to have

    RankedPlayer as BottomRanked rank = bottom_rank

    RankedPlayer as TopRanked rank = top_rank

    And then have all the logic in the subevents.

    I really believe it would be a welcome and very useful feature.

    I hope my explanation was clear enough

    Cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My current project has a Bullet object, which gets destroyed if it collides with another bullet (so far so good). What I want is to check when 3 bullets collide and make something special happen (like a big explosion). So far I haven't found a way that doesn't involve having a collision count variable that resets after a short amount of time (say, dt) and checking if it reaches a certain value. Somehow I don't think that's a very good solution, given that it's not impossible for 2 different pairs of bullets to collide at the same time, which is not what I want to check for.

    Any ideas?

    PS: I also tried comparing Bullet.PickedCount to 3 on the "On Collision" event, but it didn't work. When 3 bullets collide, all of them get destroyed, so I'm guessing that the engine treats the triple collision as 3 separate "On Collision" events