R0J0hound's Forum Posts

  • 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

  • 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.

  • You do not have permission to view this post

  • Nice job on the terrain and changing the angle of the truck.

    It's not super easy to tell how high you are other than the fast rising water. That driver has nerves of steel to attempt driving in such a volatile ecosystem.

    I wonder if giving some more variance to the grass texture may help with showing the elevation. Anyways, I had some fun seeing how long i could survive.

  • You may get better performance with a canvas instead of tilemap.

    Even with a tilemap with 1x1 tiles its slow even just erasing.

    dropbox.com/s/0jkp71pl9nvyw08/roomba_tilemap.capx

    An alternate idea is to grab a screenshot and use some JavaScript to scan the image for set pixels. It works, but it needs to flicker as I need to hide the other layers for a frame.

    dropbox.com/s/il3xbkj19f8n78n/roomba_screenshot.capx

    So here's the example using the C3 canvas. It works well for erasing but loops in events are slow, so here it does the scan of the pixels over multiple frames. Seems to work well, but if you resize the game window in any way the canvas will clear. May need some more logic to periodically save the canvas and reload it as needed.

    dropbox.com/s/ki35vb1bx2xztuf/roomba_canvas.c3p

    If you have the full version of c3 you could also handle the canvas pixel scanning in javaScript as that would be much faster.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scroll down on the properties and click "Make 1:1" to correct that.

    Typically you shouldn't get values like that. I've gotten decimals like that when I change sizes of scaled objects or something like that. But I don't understand how that occurs for unscaled objects.