R0J0hound's Forum Posts

  • digitalsoapbox

    I've only tried a handful of the bundled effects with paster, but I was only aware of effects pasting wrong, not causing an error.

    I guess it can be marked as a limitation, as I've been avoiding working on any plugins lately.

  • Look at plugins list i think there was a couple path plugins.

    I haven't used the moveto plugin but I think you can use it to do what you want. Just put your list of points in a comma separated list and use it like so:

    Global text points="10,32, 100,40, 600,2"

    Global number index=0

    Global number goalx=0

    Global number goaly=0

    X=goalx

    Y=goaly

    --- add 2 to index

    Every tick

    --- set goalx to int(tokenat(points, index, ","))

    --- set goaly to int(tokenat(points, index+1, ","))

    --- move to goalx, goaly

    Or something along those lines.

  • You could either a)check all the pixels with a loop, or b)set a variable when one of the actions to draw to the canvas is used. The latter is faster.

  • I haven't tried it in a bit but you may also need to wait a tick after setting the canvas size for scroll to to work.

  • If you want parabola movement you could use the qarp() expression

    Var t=0

    Every tick

    --- set t to time%2

    --- set t to (t>1)?2-t:t

    --- set X to qarp(a.x, (a.x+b.x)/2, b.x, t)

    --- set y to qarp(a.y, (a.y+b.y)/2-variance, b.y, t)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a better approach I found after the link above.

    You set the viewport size to the size you want.

    Next scroll to the center of what you want to capture.

    Then use the snapshot canvas action.

    When it's done you can then set the viewport back to normal and scroll back so it's centered.

  • Setting the ball's bullet setting to yes should fix the ball going through the paddle.

  • It would be a nice feature if you could use a string to set the color instead of a number, since the rgb() expression just returns a number.

    I guess in the meantime you could make a function like this to convert a rgb string to a number.

    on function "rgbText"

    --- set return value to rgb(int(mid(tokenat(function.parameter(0), 0, ","), 4, 3)), int(tokenat(function.parameter(0), 1, ",")), int(tokenat(function.parameter(0), 2, ",")))

  • Just guess but by default the stepping mode is fixed which means the timestep will be the same for every frame. So if the actual dt varies a lot frame to frame you'll get that jerking. You can change the stepping mode to variable which should help eliminate that.

    If it doesn't help then I'd guess an object with the bullet behavior moving at the same speed will have similar jerking. It's something that has come up before, and it's caused by how the browser used deals with your current hardware.

  • In construct classic arrays are 1 based as I recall. So the first element would be index 1 not 0.

  • Aldo

    Here's one way to do it. Basically loop over them and save the iid of the Sprite at the end of the loop so we can access it too at the next loop iteration using the sprite(1).x type syntax.

    Global variable prev=-1

    For each dot ordered by dot.x ascending

    ---- compare: loopindex>0

    -------- draw quad (dot(prev).x dot(prev).y, dot.x, dot.y, dot.x, 300, dot(prev).x, 300)

    ---- set prev to dot.iid

    An alternate way would be to store the positions in an array instead of that picking trickery.

    The quad points start with the top-left and go clockwise from there.

  • Not easily at least.

    You can take the positions and generate a layout.xml file using a layout xml from your capx as an example. So you'd save the generated file somewhere, close your project in c2, and assuming you had saved your project as a folder you can replace one of your project's layout xml with the one you generated. Unless there's a mistake in the xml that was generated.

    Anyways it's probably a tedious thing to do initially, and the step requiring you to manually replace files is a slow workflow.

    A more reasonable thing to do would be to save the generated positions to some text, and then put that into your game and recreate the objects from that.

  • It's just an alternate idea of one doesn't want to use a third party behavior. Chipmunk does also recreate the shape but the velocity is retained. There isn't a crash if you do it continuously. All the old shapes should be cleaned up by the garbage colllector.

  • You can also save the velocity and angular speed to variables before setting the size and setting the velocty from the variables after.

  • Here's another example exploring what can be done:

    https://www.dropbox.com/s/4o28kqq4b30pb ... .capx?dl=1

    /examples34/spring.capx

    I commented it a lot and in many ways it's cleaner than what I've done before. I'm figuring it out as I go and unfortunately it would be too lengthy of a tutorial for me to write. Math used is some simple physics such as:

    distance = speed* time

    speed = acceleration * time

    acceleration = force*mass

    spring_force = -spring_constant * displacement

    damping_force = -damping_constant * relative_velocity

    Also vectors are used. addition, subtraction and dot product.

    The dot product is used to get the speed in a certain direction.

    Some simple trig is used too.

    x = radius*cos(ang)

    y = radius*sin(angle)

    The collision detection uses the dot product to get the distance from a line. Otherwise everything is a mix of that.

    There are two unsolved things in this:

    1. The spring mesh can be made to fold in on itself.

    2. The balls can teleport through walls if either are going fast enough.