R0J0hound's Recent Forum Activity

  • If you ever have the chance I’d recommend trying to replicate the drag n drop behavior with events. It’s not too complex and can give some more flexibility. But sounds like you got what you want working with the behavior.

    By losing collision detection, I meant at the transparent bits at the corners. If it’s just an image or effect, clicking on the transparent parts will still select the object. With the mesh you will be able to click through it. You could utilize the sdf of a rounded rectangle to do the collision detection, and actually the sdf of a rounded rectangle will be the basis of the effect if you look into doing that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Things move in steps so the collision will almost always happen after objects overlap a bit. The behavior runs before the event sheet does so it makes sense that the behavior already resolved the collision and bounced the object.

    There are ways to detect the exact time a collision occurs but it mostly involves rolling your own physics engine. But beyond ball vs box collisions could get involved.

    If all you want is to have more control over the bounce angle you could save the velocity to a variable at the end of every tick. Then above that you could check for a collision and you’d have the before and after velocity and you could calculate the collision normal from that.

    You could also move the object backwards after a collision till it’s barely touching to get a more exact point of collision. However the way physics engines resolve collisions can be a bit inexact. They first push the objects apart, then calculate the bounce. If you saved the position before a collision you could use the loop idea to move forward to get a point of collision to avoid the push out inaccuracy. At that point we are using much less of the physics engine and mostly are using it for finding the collision normal.

  • Ah, it's just that the mesh edges aren't anti-aliased, but that doesn't seem like something we can control in construct. Guess you could paste to a canvas at double size and scale down to get some edge smoothing.

    Another option could be to make an effect to do the corner rounding. That would allow you to have antialiasing but you'd also lose the collision benefits.

  • You don't need to know how to use all the features of an array to use them. All arrays do is store multiple values in them, and all you need to be able to do is set the size, set values, and get values.

    Arrays indexes are 0 based, which means to access the first element of an array the expression would be Array.At(0), and the second would be Array.At(1), and so on...

    If you ever try to set a value in a cell that doesn't exist it will do nothing, and if you try to get a value from a cell that doesn't exist you'll get 0.

    And as noted above a way you can do what you're asking in your OP will look like this:

    So just literally changing a number variable to access different cells.

    The push action just increases the size of the array by 1 and places a value in the new cell. Array.CurValue, CurX, etc... are used when you use the "for each element" condition. You really don't really need to use those things. You could use normal event loops with loopindex as well. Overall arrays tend to be more closely related to traditional programming and is more abstract sometimes to understand them.

  • You can make a sprite like a 9patch with a mesh distort. Well, just as long as you want the edges and center to stretch and not repeat. You'd just need to run the event to update the mesh any time you resize the object or change the margin.

    dropbox.com/scl/fi/togz73on2n9750dx5k4y3/sprite_as_9patch.c3p

  • With 2d sprites you'd have to draw them lit from different sides I suppose.

    It may be enough to just have a gradient sprite over the flash with the additive, screen, or lighten blend mode though. You could even give the impression of a brighter flash by darkening everything underneath first. With more layers, or the drawing canvas you can mix and mask multiple light gradients with a sprite with blend modes. It's just something you'd have to fiddle with. If you find any information about how to do such a thing in photoshop or something the ideas may transfer.

    For more advanced lighting you could look into a normal map lighting effect. There is a built in one where you place the sprite, then a sprite on top to use as a normal map, and give the effect to that and provide the light location as parameters. There is also a third party effect that has more features. Anyways, the busywork to drawing/generating the normal maps of the sprites.

  • Forget about the previous touch location. Just use the distance between the sprite and touch to know if you want to simulate a control or not. Seems smooth on my end.

  • An alternate to using css, blend modes, or the drawing canvas to do it would be to use a mesh distort.

    dropbox.com/scl/fi/tstr83o5l7mixoeayie2v/Rounded_sprite_mesh.c3p

    You could use the approach to crop to any convex shape and even some concave ones, but not all.

  • Construct doesn’t have 3d collision detection yet. So collisions are just 2d. Hence only the base getting collided with.

    At this point you’d have to roll your own 3d collision detection or find someone else’s solution to that and use that instead.

  • Yeah it’s been like that since Construct 2 first came out. It was noticed and asked about as I recall but it wasn’t changed. It would be something to find that post though.

    The difference only really matters for shapes placed perfectly on a grid at least. And mostly is just an issue with rectangle shapes. I tend to shrink the collision poly slightly, or shrink the size slightly, or do my own aabb collision check if it matters.

  • With JavaScript you’d have to save/load state manually with some api callbacks I think.

    Drawing canvas pixels and images/sounds loaded from urls aren’t saved either. You’d need some additional logic to save/load those.

    Everything else you listed should work fine. Things like hierarchies, timelines, flowcharts, etc… are just state and should save/load just fine barring any bugs.

    Event stuff like loops and variables will either not need to be saved/loaded or will save/load just fine.

    Sounds like the only thing you need to look at is async stuff. The file/network stuff makes sense to not work. Stuff running in a worker like finding a path makes sense that they wouldn’t work too.

    That said “wait for previous” should work with the “wait” and “wait for signal” actions since that is serialized.

    I don’t have a hard fast rule for all the async actions. They should be easy to identify since construct labels them all. I’d suspect a fair amount of them can save mid progress though.

    You could add some bookkeeping events around those actions to keep track of how many async things are running, and maybe when you want to save/load set a variable that prevents any new ones to start and wait till all the pending ones to complete before saving/loading. Just an idea.

    Anyways, just some thoughts.

  • To compare two separate instances of the same sprite type you could utilize a family with just that type to be able to pick two instances independently. Or you could pick one, save info about it to some variables, then pick the other.

    Personally I like a variety of the latter and pick one instance, save it's iid to a variable, then pick the other instance. As an example you could set up the events like this:

    var i=-1
    
    sprite: pick random instance
    -- set i to sprite.iid
    
    sprite: pick random instance
    compare: sprite.animationFrame = sprite(i).animationFrame
    -- sprite: set animation frame to self.animationFrame+1
    -- pick all sprite
    -- pick sprite instance i
    -- -- sprite: destroy

    Generally I find using one sprite type for all the cards is the cleanest way to go. You'd just differentiate between to cards with different animation frames and instance variables.

    Here's a more complete example that could give you some ideas.

    dropbox.com/scl/fi/3y3ql8yvicyxklrcp0qbj/card_merging.c3p

    Besides that some like to use arrays or json to handle the logic and update sprites from that. I find it becomes rather hard to read as it looks more abstract, but it could allow you to avoid more of the picking system of the event sheet.