R0J0hound's Forum Posts

  • The trigger "on click" is run when the mouse clicks, it's not run top down.

  • I haven't used effects in a while but here's a writeup about all the variables C2 provides:

    Tiledbg uses the plugin setting pf_predraw flag which seems to affect the drawing of effects. I haven't figured out how but the relevant part of the runtime is the renderEffectChain function in layout.js. This is probably where the choice between screen space and object space is used.

    Is there an easier way of getting absolute screen-space pixel coordinates?

    That way should be right based on what I found for that guide.

    If void main is called for every pixel, is it unnecessary to put certain calculations in there?

    The only way for it to calculate it once would be to calculate it before hand and put it in as an effect parameter as far as i know.

    Why isn't alpha reserved when I only adjust the rgb?

    It has to do with pre-multiplied alpha.

    I'm not sure about the other issues. There's a lot going on in the renderEffectChain function in layout.js, and it probably explains when object space is used and when screen space is used, but in the interst of time it's probably a good question for ASHLEY.

  • Actually both canvas2d and webgl have their quirks.

    With canvas2d the tiledbg is a rectangle with an image pattern fill. Sprites are drawn with the drawimage function, which doesn't have repeat, and is faster than a pattern fill. But yeah, a repeat property could be used to easily switch between the two rendering methods.

    With webgl the tiledbaground image needs to be power of two to be able to repeat. The runtime does the resizing for you when the object type is first created, and this may also be why things are different with effects. Other than the size issue, the difference between sprite and tiledbackground is mainly just a webgl texture setting as I recall. Webgl2 allows for non-power of two texture repeating but it's a long way off. Another possibility would be to write a shader to do the repeating but this wouldn't be as fast.

  • I don't know how a wait command can be used. Another idea occurred to me, just make a repeat loop to eat up time.

    global number time_eater=0

    system: compare fps>15

    --- add 10000 to time_eater

    else

    --- subtract 10000 from time_eater

    repeat time_eater times

    ---

  • You may have more luck with using the chipmunk physics behavior instead. It provides more control over adding joints. The built in physics behavior only attaches joints to the origin or image points of objects.

    So as I understand it, the basic Idea would be:

    1. give the physics (or chipmunk) behavior to all the bones, and have it disabled at the start.

    2. when you want to ragdoll, enable the physics and add joints between the bones at the pivot points (like the knee for example).

    Adding the joints is the only tedious part. Here's the capx you posted with the chipmunk behavior used. Press space to ragdoll (or mostly just scuttle) the player. I quickly added imagepoints on the objects to define where the joint should be, and attached the head all the way to one foot. It's not perfect, but this was mainly just for a proof of concept so I didn't fine tune it. However if you put the time in you can get it fully working.

    https://dl.dropboxusercontent.com/u/542 ... uttle.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are two parts to that, visual and collisions.

    For the visual you can either pre-draw the terrain or use the paster object to draw a bunch of quads to distort an image. Here's an example that distorts a image, so maybe it could be useful. The math may not be useful in your case but the gist of it is just have a bunch of quads next to each other with the corners moved to distort things. If you've done uv texturing in 3d software, the idea can be used here and the more quads you use the smoother it will be.

    viewtopic.php?f=183&t=166708&p=1006165&hilit=trail#p1006165

    The collision portion is the next problem. Here's one that takes a vector image export and creates a bunch of lines to use as the terrain. Another option is to use the points of the quads from the visual portion and use them instead to place the collision lines.

    viewtopic.php?f=147&t=167397&p=1008607&hilit=curve#p1008607

    On a side note the ground tile can be added by using a blend mode.

    Here's a more specific example:

    /examples32/hillclimb.capx

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

    It creates the hills using sprites used as lines. I wasn't super creative so I made the shape of the hills the combination of two sine waves. Look at the set y action in event 2.

    It also fills in the area below those sprites so it's a filled area. The tiled background is then pasted with the source in blend to texture that area.

    The final step is to loop over the line sprites again draw a textured quad on the surface for each one.

    It works, and shows a simple case, but it would need more work to do scrolling and such.

  • Short answer:

    You can't.

    Long answer:

    C2 is synced to the screen refresh rate, typically 60fps, and there isn't a way to change it. If you want to get creative you could only move objects every 1/15th of a second to get that effect, but you can't use any movement behaviors.

  • Open topic is a good place for this. If it was originally somewhere else I approve of it being moved here.

    One thing I enjoy is clearing brush with a machete.

  • They're kind of like clamp. Min will only keep the lowest value, and max will keep the highest. I used it here to stop the value from passing 50 from either direction.

    Min(a,b)

    If a<b then it will be a

    If a>b then it will be b

    Max(a,b)

    If a<b then it will be b

    If a>b then it will be a

  • There have been other topics on this and there isn't such a function, but you can do it with a speed variable.

    Global number speed=0

    Every tick

    --- add 1 to speed

    Box X <50

    --- box: set X to min(50, box.x+speed)

    Box X > 50

    --- box: set X to max(50, box.x-speed)

  • BioMechanical

    The three ways to access values values are the following. Also they are the same expressions given when you select them from the expression list.

    Array(x)

    Array(x,y)

    Array(x,y,z)

    To use them replace x,y and z with a value. Also keep in mind the indexes start at 1 not 0.

    So to get the first value of an array you'd use:

    Array(1)

    For the second:

    Array(2)

    and so on...

  • I wouldn't worry about it unless it becomes slow to save/load.

  • The simplest is to put all the objects you want to z sort in a family (player, trees, walls, enemies). Then use a a for each ordered condition.

    for each family1 ordered by family1.y ascending

    --- family1: move to front

  • When you release you need to convert the angular velocity to a linear one. The equation for that is:

    linear = radius*angular

    where angular is in radians.

    Here's a complete calculation:

    radius = distance(bar_contact_zone.x, bar_contact_zone.y, player.x, player.y)

    angle_of_motion = angle(bar_contact_zone.x, bar_contact_zone.y, player.x, player.y) +bar_rotation*90

    speed = radius*bar_turn_speed*pi/180

    velocityX = speed*cos(angle_of_motion)

    velocityY = speed*sin(angle_of_motion)

  • InvaderX

    I guess this is a very late reply, but you could pick a random map sprite and create stairs on that.

    corpvs2

    I don't think I fully understand, but this was designed to have each room be the same size (one screen). It make it able to do different size or even L shaped rooms would be a lot harder, and probably require a new approach.