R0J0hound's Recent Forum Activity

  • Your code wasn't correct. The total length is zero because you set it to zero when loopindex=p.count-1 aka at the last instance. It should be loopindex=0 like in the pseudo code. Also you don't need to use abs() with distance because distance is already always positive, but that has no effect.

    The verlet rope physics doesn't work too well when wrapping around small obstacles as you noted in the layout. It can be improved by decreasing the distance between links and/or running the physics with multiple smaller timesteps, but it still can fail. I think it could be improved by doing collision detection/response between the obstacles and the lines between links, but that's not a simple to solve with the circle vs sdf collision detection used.

  • Can't open your file. I think it's not publicly shared?

    Probably that wait is causing problems, but I can't really follow it.

    Anyways this should measure the total length between multiple instances of sprites making up the chain.

    var totalLength=0;
    
    for "" 0 to p.count-1
    -- loopindex = 0
    -- -- set totalLength to 0
    -- else
    -- -- add distance(p(loopindex-1).x,p(loopindex-1).y,p(loopindex).x,p(loopindex).y) to totalLength
  • Awesome Rojoh!

    Working great here on (Windows + Chrome)

    Thank you))

    Glad it worked. Just updated the css file to replace most of the pink icons on the forum as well. If you want a different color you'd have to edit each one.

  • Tested my idea:

    dropbox.com/s/9uksvlft6yxnx6f/transparent_when_behind.c3p

    Z goes up instead of down so that last condition needs adjusting and it works.

  • In an effort to get rid of the pink I made a css file to change the color in as many areas as I could.

    dropbox.com/s/4x3vuplxii5zzlq/Scirra_less_pink.css

    Tested as working on:

    iOS Safari using Userscripts extension.

    Windows Chrome using "User Javascript and CSS" extension.

    Other browsers likely has extensions where you can inject user css too.

  • A slightly different way you could do it is to sample points on the line between the camera and each tank. If any point overlaps a wall in 2d and the point z is between the top and bottom z of the wall, then that point is inside the wall and you can make it transparent.

    The events would basically look like this:

    var steps=0
    
    every tick
    -- tank: set opacity to 100
    
    for each tank
    -- set steps to ceil(sqrt((camera.x-tank.x)^2+(camera.y-tank.y)^2+(camera.z-tank.z)^2)/32)
    -- repeat steps times
    -- pick wall overlapping point: lerp(camera.x, tank.x, loopindex/steps), lerp(camera.y, tank.y, loopindex/steps)
    -- value lerp(camera.z, tank.z, loopindex/steps) is between wall.z and wall.z+wall.zheight
    -- -- wall: set opacity to 50

    I can never remember if z goes up or down so the code assumes z goes up. If z goes down you’d need to change the in between values condition to: wall.z-wall.zheight and wall.z.

    In the steps calculation it uses 32 to make it sample points every 32 pixels. You can make that smaller to make it more accurate although it would be a bit slower.

  • Try Construct 3

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

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

    The new hot pink text color is pretty harsh on my eyes. The previous green color was better. Maybe as a compromise a setting could be added to the user profile to let users use a different color if they so choose?

    Thanks

  • Cool, glad you got it working. I think you could possibly just use the body and the canvas will inherit the same stuff. Anyways I think that touch- callout may have been key.

  • Hmmm, well this can be solved by the user-select css property according to my research. There are two variations of that to work with safari and internet explorer. I can't seem to find where this is used in C2 but I haven't looked too hard in C3. Could this be something that was overlooked? It probably should be reported.

    Anyways running this script at the start of the layout should fix it I think.

    c3canvas.style.webkitUserSelect=c3canvas.style.msUserSelect=c3canvas.style.userSelect="none";

    Edit:

    It's not an issue on pc best I can tell. I was able to test this on safari on ios and this does keep the canvas from being selected.

  • It's mostly just a bunch of perlin noise mashed together.

    Possible example. In C3 just use the advanced random noise instead. Anyways it's just a lot of number fiddling.

    dropbox.com/s/9shcpwjkf4spvwb/noise_gen4.capx

  • If you mean you move the cursor around with the Gamepad just like a mouse then it’s fairly straightforward. You’ll need three events: one when the button is pressed, one when it’s down, and one when it’s released.

    I’m assuming you have a cursor sprite that you move with the Gamepad. Anyways, give it three instance variables dx,dy, and obj2drag. Obj2drag should start as -1. Then the events would look like the following to work with one sprite type.

    on button pressed
    pick sprite overlapping point cursor.x, cursor.y
    sprite: pick topmost
    -- cursor: set obj2drag to sprite.uid
    -- cursor: set dx sprite.x-cursor.x
    -- cursor: set dy to sprite.y-cursor.y
    
    is button down
    pick sprite by uid cursor.obj2drag
    -- sprite: set position to cursor.x+cursor.dx, cursor.y+cursor.dy
    
    on button released
    -- cursor: set obj2drag to -1
  • Construct should block that internally. What kind of mobile device? iPhone or Android? What browser?

    From what I gather from googling there is some css to make something not selectable and/or some JavaScript to stop the default behavior in a touch input handler.

    I ask because I’m interested in the cause and solution myself. I haven’t had a chance to do any tests yet though. Overall I think that sounds like a bug or at least something that should be fixed. Have you tried filing an issue? It sounds easy to reproduce.