R0J0hound's Forum Posts

  • Since this is C3 you could also use the tiledBackground instead of the canvas. You'd still create an instance per slice, but you can set the "offset y" to select the correct part of the image. Could be even used for per pixel, it's just more instances.

    The pro is it would use less vram since it's just reusing the one texture.

  • Pardon the late reply. It’s been a long week.

    The action that sets the y position has as I recall a +200*dt*dt at the end of it. The 200 is the gravity and you can change that to whatever you want.

    Changing it isn’t really the way to do different materials. The algo I used is basically only one type of cloth. It could be made stiffer by doing more iterations of constraining the points together or adding diagonal constraints too.

    There may be other algo with more tuning parameters.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • pillaystation

    It’s more effort than I have time for to make videos of these. I also don’t have a YouTube account.

    Anyways, they are all vanilla c2 so it should be quick to try, even in the free version I’d imagine. They do utilize some js so they won’t work as is in c3.

  • Oh true. I forgot about the behavior enforcing the max speed for you.

    He said he was expecting an orbit, but real gravity would be similar.

    To stop the orbit you could apply a brake to the tangent speed so it would fall straight down. The break could be just a velocity opposite the tangent velocity and you could make it inversely proportional to the distance. Basically that would make it brake faster the closer it is.

    a = angle(sprite to target)+90

    tanvel = vectorX*cos(a)+vectorY*sin(a)

    d = distance(sprite to target)

    If d>0

    vectorX = vectorX - tanvel/d*cos(a)

    VectorY = vectorY - tanvel/d*sin(a)

  • It’s a bit hard to debug big formulas like those, but basically you’re accelerating toward the target and limiting the the speed?

    I’d break it up into multiple steps and once that works you can combine it again.

    Local number a

    Local number speed

    Every tick

    Set a to angle(sprite.x, sprite.y, target.x, target.y)

    Set vectorX to vectorX + accel*dt*cos(a)

    Set vectorY to vectorY + accel*dt*sin(a)

    Set speed to sqrt(vectorX^2+vectorY^2)

    Compare: speed>maxspeed

    Set vectorX to vectorX/speed*maxspeed

    Set vectorY to vectorY/speed*maxspeed

  • That’s just a matter of toggling the “fixed” Boolean. False will move and true won’t.

  • The gradient does seem to add depth to it.

    I haven't used the distort mesh feature of c3 yet. I don't see it being good for a perspective transform though. When you make a square into a trapezoid the two triangles that make up the quad become very visible.

    I think the best we can do with vanilla C2 is a sprite sliced up into 1 pixel thick slices. Then reverse the math to do the distort. It's not optimal with 480 sprites for just one quad, but it matches the perspective model used. In c3 you could use the tiled background plugin instead. It adds image offset and image scale, so you don't have to actually slice up the image. It even has image rotation so you could possibly do full mode7 without shaders, maybe.

    dropbox.com/s/dokfcr8k3c0em8d/perspective_test.capx

    Anyways, mikal's fqz plugin would probably be simpler for c3.

  • Here's the same example using the paster plugin to do the image distort.

    dropbox.com/s/oytkk98dpznc4od/verlet_cloth_paster.capx

  • The only one that comes to mind is the paster plugin. It has a draw textured quad action.

  • It can but not with vanilla C2. In C1 and C3 there is the distort mesh feature that you can use to distort the image from the points. You'd just hide the point sprites.

    With C2 you can only do the distort with third party methods which don't transfer to C3.

  • Here is one possible way. It's just a bunch of sprites that are connected with a bunch of links. Basically the links are a maximum distance that two sprites can be away from each other.

    The concept can be applied to physics objects but it also pushes the objects apart so the result is more like jello.

    Here i used some loops to pick all the pairs of sprites. It would be pretty tedious without it.

    dropbox.com/s/97rg6wqyjipfm9o/verlet_cloth.capx

  • Here's one idea. The two concepts are rotating around a point and prespective transform.

    Rotation is easy enough. The formula is:

    newX = (x-centerx)*cos(a)-(y-centery)*sin(a) + centerx

    newY = (x-centerx)*sin(a)+(y-centery)*cos(a) + centery

    The beauty of that is we can do a rotation in 3d by replacing xy with yz for example. We can use that to calculate the 3d positions.

    The next part is to calculate the screen transformation.

    fov = 60

    eyez = 320/tan(fov/2)

    screenX = 320+x*eyez/z

    screenY = 240+y*eyez/z

    scale = eyez/z

    Then we just hide anything with a z less than 1, and sort the sprites by z.

    The only other tweak is to move everything forward before the perspective transform by adding say 200 to the z variables after the camera rotation.

    Anyways here's the implementation.

    dropbox.com/s/86iitq0a0n1msbs/starve_test2.capx

    I do like the container idea too. You'll want the displayed sprite, and the one you move with events to be different. As far as the textured floor i don't think the mode7 fx would be suitable for this since it doesn't handle looking up and down.

  • Yeah, I’ve found my examples are getting more complicated as of late. Mainly because I’m going from scratch and barely using features or plugins that could possibly make it simpler.

    Anyways it was fun to attempt at least. I’m sure someone may come up with an alternate approach that’ll be easier to understand.

  • Here's a example. It's not true perlin noise but it is smoothed noise.

    smoothed noise can be done as simply as filling an array with random values and using bicubic interpolation to get in between values. Here I went a step further and just used a 1d array and used a hash to pick an index from any x,y.

    Anyways, the actual terrain generation in event 6 should be much the same no matter what noise function you get. Although you probably would want to use a tilemap instead of sprites.

    dropbox.com/s/54umwiypls46s0l/noise_gen.capx

  • Cool example. I thought I'd try my hand at preserving the horizontal letter spacing when on the curve.

    There is a text.textwidth expression that is useful for measuring the text, but it only gives a value after the text is drawn. Anyways, for example if you have a word like "Hi" I was first positioning the "i" after the width of "H", but found it worked better by positioning "i" after the width of "Hi" minus the width of "i". That way it indirectly got the horizonal kernal too.

    The second part is to position the letters a certain distance along a path. basically it involves converting the curve to a polyline so we can measure distances.

    Made in c2 but should work the same in c3.

    dropbox.com/s/b4xskuisrxkies8/text_on_path.capx