R0J0hound's Recent Forum Activity

  • So you just want to change the view? You can use the 3d camera object to do that to some extent. You can position objects xy and zElevation.

    Control wise all the movement behaviors are 2d on the xy plane so you'll need to do the z axis motion with events.

    If you don't want to use 3d and instead want to do the rotation/perspective with math and just sort the objects in 2d then the two building blocks for that are:

    1. Rotation of a position around a center. Here it does it on the xy plane but you can do it on the xz or yz plane too. The equations are the same, just change what axis is used.

    newX = (x-centerX)*cos(a) - (y-centerY)*sin(a) + centerX

    newY = (x-centerX)*sin(a) + (y-centerY)*cos(a) + centerY

    2. perspective transform and scaling. Here k is some scaling factor that adjusts the perspective. Keep in mind you'll want to hide objects with a z<1 as they are behind the camera, and you'll need to sort the objects by z.

    screenX = k*(x-scrollx)/z + scrollx

    screenY = k*(y-scrolly)/z + scrolly

    objScale = k/z

  • That was a bit older example, and I was going for a certain look but as you pointed out it doesn't move accurately. I'd probably need to figure out the formulas again to account for that. Probably simpler to use the other capx though.

    Like in that video the box is rotated around a corner and every time the box lands on an edge (every 90 degrees) it changes which corner to rotate around.

  • dropbox.com/s/q3fejozejh7s2ix/closest_value_in_list.capx

    As a similar idea to yours just loop over the list and you can see how close two values are with abs(value1-value2). So the code below would first use the first item in the list as the closest then it would select any item that was closer than the current closest.

    var list="1,44,33,66,7"
    var item=0
    var value=33
    var closest=0
    repeat tokencount(list, ",") times
    -- set item to int(tokenat(list, loopindex, ","))
    -- if loopindex=0 or abs(item-value)<abs(closest-value)
    -- -- set closest to item

    This checks all the values and works if the list isn't sorted.

    Yours stops as needed since your list is sorted.

  • Can you explain what you’re after a bit more? It’s not clear to me.

    Your images are different views of 3D meshes. So if you placed cubes down and adjusted the camera you can get the same look. But your descriptions made it seem like you’re after something else

  • I see what you mean by the blob not being a solid color after using the alpha clamp effect. At least with any color but black. I think it has to do with how the effect handles premultiplied alpha perhaps if someone wishes to make a modified effect.

    As for the quality of the edge you can use different gradients to change that a bit. I’ve found the soft brush in the C2 image editor makes a nicer gradient than the soft brush in C3’s image editor, but other image editors could create better ones.

  • Finally got around to finding a decent solution to this.

    To do the jump I have it squish horizontally as if it was a muscle. I works pretty well as it jumps only if on the ground.

    dropbox.com/s/5ao27efbsdox8bm/jello_no3rdParty_keyboard2.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was going to attempt to make an example but I found a lot of previous tests that may be helpful. There are probably more but my naming convention is inconsistent. Some use physics for the motion, and some do the motion with math in events. I skimmed over them briefly but maybe a third of them have the forces between every pair of objects.

    dropbox.com/s/8bimqsdnysh5bov/orbital_simple.capx

    dropbox.com/s/eldpa0s7zvfr333/orbit2.capx

    dropbox.com/s/tk76c6cmc4vlocd/orbit.capx

    dropbox.com/s/5dpb882vdi03d00/orbit.capx

    dropbox.com/s/gle6gz7lbo18cq7/orbit_physics.capx

    dropbox.com/s/9zx2ivqzli2ewbx/orbital.capx

  • Ah, so you mean just rolling a sprite then?

    dropbox.com/s/gora2uebn0e4wov/box_roll.capx

    Even found an old example that does it in a different way.

    dropbox.com/s/kx8kbfpqpimuec5/box_walk.capx

  • Roughly you’d do this to apply gravity between two objects a and b. You’ll have to tune it though. Adjust the masses of the objects, and the g variable.

    Var g=10000
    Var ang=0
    Var force=0
    
    Every tick
    — set ang to angle(a.x,a.y,b.x,b.y)
    — set force to g*a.mass*b.mass/distance(a.x,a.y,b.x,b.y)^2
    — a: apply force (force*cos(ang), force*sin(ang))
    — b: apply force (-force*cos(ang), -force*sin(ang))

    That handles the gravity between a pair of objects. You’d just have to do that between every pair.

    If you search my posts I’ve made an example or two in the past if that helps.

  • Here is a possible way using a distort mesh to make the cube and some math to rotate around a center on an axis.

    dropbox.com/s/5n5umhdkfhr0qhg/cube_roll.c3p

  • winstreak

    Nice analysis.

    From that idea the distance on the grid with diagonals would be

    int(max(abs(treasure.x-tile.x),abs(treasure.y-tile.y))/32)

  • For each black hole apply a force to the sprites toward blackhole.x,blackhole.y and the amount of force would be

    K/distance(sprite.x,sprite.y,blackhole.x,blackhole.y)^2.

    K is just some number. If the black hole is too weak just use a bigger number.