R0J0hound's Recent Forum Activity

  • link updated

  • Exactly like that? Looks like a quad mesh around the island. Then the uvs are lerped to give the motion. Probably this is done twice to get two different waves.

    Instead of messing with the uvs you probably could move the corners of the quads instead but that would require more math.

    Realistically this is not something that Construct gives you the tools to do. In construct2 there is the paster and customDraw third party plugins that have a way to draw distorted quads like that, but it's fairly low level. Construct 3 at this point only has the funky quad third party plugin, but it doesn't let you mess with the uvs as far as I know.

    Another approach that you may be able to get to work well enough with some artistic finesse is to just place a bunch of wave sprites around the shoreline and move them forward toward shore. Here's a rough example of that:

    uc70c1e00523e47ddf8c17ea383e.dl.dropboxusercontent.com/cd/0/get/CiERS1WJ6FNPuoSxx0gRNk5ntGHHcMd7Nx74S69VnROdCWqAUUHIckYPdJmE4KZyIXPof1RRjwZbuGlZ4r6LRr75Jv2y9qO-Z9fBCFSKHOtaMuqynytz_eqPUttKOLEPQrg/file

  • So you want:

    * moving, scaling and rotating via handles.

    * for multiple objects at once.

    * undo/redo stack

    * variables per object. Construct variables or your own?

    * constraints on position, angle, rotation.

    * conditions when editing is being done and such.

    An example could be made but it would be specific to that example. It's not simple to adapt it to an existing game. There are lots of things that need to tie in. A plugin would just add more complexity in a different area.

    There are a few examples around the forum of parts of what you're after.

    construct.net/en/forum/construct-2/how-do-i-18/resize-handles-example-48892

    construct.net/en/forum/construct-2/how-do-i-18/how-do-i-scale-multiple-sprite-140330

    construct.net/en/forum/construct-2/how-do-i-18/how-t-rotate-a-sprite-using-x-133067

    construct.net/en/forum/construct-2/how-do-i-18/how-do-i-rotate-sprite-then-se-85784

  • I mean you could do an expression like:

    Set var to int(time*30)

    To get one to be added 30 times in a second. Then it would be just integers.

    In general the expression would be

    int((time-starttime)*rate)

    Do you want something to happen every time the car changes by one? I don’t think I follow why you’d need >=. I mean you could do something like the following to do something every time it changes by 1. Depending on what you want to happen you may have to do some interpolation if say you wanted to shoot bullets and they need to be spaced correctly.

    Global number prevVar=0

    Global number var=0

    Every tick

    — set prevVar to var

    — set var to int(time*30)

    Repeat var-prevVar times

    — do something

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I’d just add n*dt and int() the value every time you access it.

    I guess if you don’t need to access the variable very often you could just do this right before you access the value:

    Global number starttime=0

    Some condition

    — add (time-starttime)*dt to variable

    — set starttime to time

    — do something with the variable

    I doubt either would be noticeably faster.

  • Well, all parallax is is this:

    (Originalx-scrollx)*0.6+scrollx

    And the same with y

    Z scaling is basically

    X = f*originalx/z

    Where f is the focal length. I don’t know what value construct uses for that.

    There’s a bit more to it than that and usually they tie in the camera distance and relate it to the focal length. Also the perspective is around the center of the screen so we have:

    X = cameraZ*(originalx-screenCenterX)/(z+cameraZ) + screenCenterX

    Y is basically the same. Width and height are slightly simpler:

    Width = cameraZ*originalWidth/(z+cameraZ)

    As written, when the z of an object is unchanged then the position and size won’t change. Negative z is bigger and positive z is smaller. If that’s opposite then just make cameraZ negative. Smaller cameraZ values make more sever perspective and higher make less sever.

    I haven’t investigated but cameraZ may be something simple like 500, or if C3 has a way to change it, then use that value.

    Anyhoo I guess with all the above we can calculate the simulated z or scale of a certain parallax.

    And looks like you assumption is correct. The scale is equal to the parallax.

    On a side note if you wanted to do the parallax with z instead of a parallex layer you can do this:

    Z = cameraZ/parallexX -cameraZ

  • There’s this old topic that may be relevant. It has a way to do 2d physics for pool. It improves on the collisions by finding collisions when the balls just touch instead of counting the first time it overlaps as a collision. My method was slow at converging on a solution at times.

    construct.net/en/forum/construct-2/general-discussion-17/approaching-pool-ball-movement-56649

    It can be made more precise by just calculating when two balls hit. I think the above moves the balls as normal and once any of them overlap all the balls are moved back a bit at a time till they are just not overlapping, and then doing the bounce calculation.

  • Perhaps it doesn’t work anymore. I don’t really know. Maybe just draw with white for erasing.

  • Just the same idea. Possible example in 3 actions.

    Sprite: set blend mode to destination out

    Paster : paste sprite

    Sprite: set blend mode to normal

  • I get lost with equations pretty easy. So let’s start over.

    If you have 4 points: A, B, C, D

    You can make a curve through it where it ends on points A and D and the control points are B and C, but they won’t be on the curve.

    So something like this to get the points to to draw the curve along.

    Repeat 10 times

    — set x to cubic(ax,bx,cx,dx, loopindex/10)

    — set y to cubic(ay,by,cy,dy, loopindex/10

  • No, you have it right.

    The first and fourth parameters are the end points, and the 2nd and third are the control points.

    The last parameter is a number 0 through 1. We do the curve by using cubic() for x an y and setting the last to various values between 0 and 1. So for example 0, 0.2, 0.4, 0.6, 0.8, and 1 to make the curve from 5 lines.

  • inkfalcon

    Nope.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound