R0J0hound's Forum Posts

  • Here's a way to do the trimming.

    dropbox.com/s/al8uh05egssr79p/trimArray.capx

    It amounts to scanning the whole array and finding the min/max of x/y for any cell containing a value. Then the the values are shifted over and the array is resized.

  • Else when used with object conditions may not do what you want.

    Sprite: x<100
    — do something
    Else
    — do something else. No sprites are picked

    One possible solution is to use the system compare condition instead of object conditions so you take picking out of the situation. Bear in mind this would work because there’s only one player object.

    So from this

    Compare: obj = “axe”
    Player: slotfull<6
    — place in inventory
    Else
    Compare: obj = “axe”
    Player: slotfull=6
    — place on ground

    To this

    Compare: obj = “axe”
    Compare: Player.slotfull<6
    — place in inventory
    Else
    Compare: obj = “axe”
    Compare: Player.slotfull=6
    — place on ground

    But there are other ways to structure it. You don’t always need an else. I’d probably go for something like this

    Compare: obj = “axe”
    — Player: slotfull=6
    — — place on ground
    — Player: slotfull<6
    — — place in inventory
  • Here's one idea how to do it. I went with doing rotation similar to how the construct 3 editor lets you rotate objects.

    dropbox.com/s/zjsrx3a43imr2a0/drag_and_rotate.capx

  • Here's a simplified single object, one instance variable version.

    dropbox.com/s/6qs81zmktsd3so8/yaxis_rotate.c3p

  • Also it’s possible replicate a cube with mesh distort. Then with a bit of math you can rotate it any way you like.

    construct.net/en/forum/construct-3/your-construct-creations-9/example-mesh-distort-sphere-161470

  • Well there is a depth buffer, and transparency does mostly work in 3D. Not always though.

    You can rotate the corners with a bit of math. It’s just a matter of applying them to a distort mesh.

    One idea place four sprites at

    -32,-48

    32,-48

    32,48

    -32,48

    These will serve as our points. Give them three instance variables z, Newx and newz.

    then you can rotate them with:

    var a=0
    var sa=0
    var ca=0
    
    every tick:
    — set a to time*10
    — set sa to sin(a)
    — set ca to cos(a)
    -- sprite: set newx to self.x*ca-self.z*sa
    -- sprite: set newz to self.x*sa-self.z*ca
    
    every tick
    — card: set size to (1,1)
    -- card: set distort mesh to 2,2
    -- set distort at 0,0 to card.x+sprite(0).newx, card.+sprite(0).y, 32+sprite(0).newz, -1,-1
    -- do the same for the other points: 
    0,1 with sprite(1)
    1,1 with sprite(2)
    1,0 with sprite(3)

    sorry i trailed off with the bit where you set the distort points. generally youd have card have a size of 1,1 and place the points with absolute. Unless something changed you can’t use a negative z for a distort point, so you’d need to shift things a bit higher.

  • Cool. Glad that helped.

  • One idea for the jumping would be to relax the spring forces momentarily then make the spring forces stiffer for a bit. But I guess there may be other ideas.

    Making other shapes should be possible, but it just would take more setup. All the rest lengths of the edges, and all the rest areas of the triangles. The other issue is while a grid is easy to texture with distort meshes, other shapes could be trickier.

  • It’s hard to reason about more complicated cases. One thought that comes to mind is objects that are side by side on the x axis may be considered overlapping with that bounding box code. That would throw things off. Maybe shrinking it a bit may help:

    A.bbboxleft is between B.bboxLeft-A.width+1 and B.bbboxRight-1

  • I changed mine so z up is positive and compared what I did with yours:

    yours: dy = (A.y+A.z)-(B.y+B.z)-(A.sy-B.sy)/2
    mine: dy = (A.y+A.z)-(B.y+B.z)-(A.sy-B.sy)/2
    
    yours: dz = -A.z+B.z-(A.sz-B.sz)/2
    mine: dz = A.z-B.z-(A.sz-B.sz)/2
    
    yours: best = ((abs(dy)-(A.sy+B.sy)/2)>((abs(dz)-(A.sz+B.sz)/2))?dy:dz
    mine: best = ((abs(dy)-(A.sy+B.sy)/2)>(abs(dz)-(A.sz+ B.sz)/2))?dy:dz

    It's just your dz equation that is off. The rest looks correct from what I can tell.

    You can do your own bounding box check if you want to reserve the collision poly for collisions. These two conditions would do that:

    A.bbboxleft is between B.bboxLeft-A.width and B.bbboxRight
    A.bbboxTop is between B.bboxTop-A.Height and B.bbboxBottom
  • AnD4D

    Here is one possible way if all your layers are visible.

    global text name="fish"
    
    is layer name visible
    -- layer exists
    else
    -- layer doesn't exist
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is the sorting with the perspective you're using.

    dropbox.com/s/m1p2f090xmqa230/alt_iso_sort.capx

  • I like how simple alextro's formula is. Unfortunately that will only work with isometric blocks with the same size.

    For different sized blocks you need to figure out which objects are in front of the other. Consider the simplest case of two blocks. This site does a nice job at explaining a way to do that:

    bannalia.blogspot.com/2008/02/filmation-math.html

    Once you have a way to decide which of any two blocks should be in front of the other you can use that to progressively sort the scene. You only need to sort objects visually overlapping each other. For making everything sort more instantly, you can use a topo sort if needed.

    In my latest tests I've found the step of figuring out which of two blocks should be in front of the other is closely related to pushing one object out of the other for Collison detection. Basically find the normal of the collision/overlap of each pair. Even if the objects aren't overlapping in 3d it's possible to find this normal. If you're not familiar with normals, they are just the 3d direction from one contact face to the other object.

    Anyways with that you dot product the normal vector with the direction of the screen. If <0 then one object is in front, otherwise the the other is in front.

    Here's a test of that.

    dropbox.com/s/9veb43lyxd7bja0/iso_sort3simplified.capx

    Anyways, for the perspective you're using it will be simpler than sorting for a isometric view, but the idea is similar. I was attempting to adapt my example to your perspective but not much luck yet. Hopefully it gives some ideas, or you stumble on a simpler solution.

  • Link now fixed. Guess I need to verify the links I’m copying from Dropbox. That’s been happening a lot lately.

  • alextro

    Ah, thanks man. That's at least the second time i've done that this week. Link fixed now.