R0J0hound's Recent Forum Activity

  • If the sprite is rotated then the formulas look a bit more involved. It unrotates the position, before scaling.

    Meshx = ((x-sprite.x)*cos(-sprite.angle)-(y-sprite.y)*sin(-sprite.angle))/sprite.width

    Meshy = ((x-sprite.x)*sin(-sprite.angle)+(y-sprite.y)*cos(-sprite.angle))/sprite.height

  • Mesh points are relative to the position, angle and size of the object. That can be useful or inconvenient depending on what you want to do.

    If the sprite isn’t rotated then this should work to get an x,y position on the layout converted to a mesh point location.

    MeshX = (x-sprite.x)/sprite.width

    MeshY = (y-sprite.y)/sprite.height

  • Your code seems to be ok up till the phase where you do the attacks. But I can't place what's amiss at that point. As you stated you have a lot of variables for the state, and it's tricky to debug where the logic error is.

    A slightly different way to go about it could be to have a single state variable to organize the different steps. I guess this is called a state machine.

    Anyways here's an example made from the free version. Although that probably made the events a bit odd looking in spots to get it to fit.

    dropbox.com/scl/fi/ugfnxtiht6kijgrqtqyq3/rpgBattle.c3p

    Could be useful for ideas possibly.

  • I don’t think you can? At least not with Ajax.

    A quick google search yielded this. Apparently it’s possible to do from the server side but not from JavaScript on the client side.

    stackoverflow.com/questions/30622369/easiest-way-to-get-list-of-files-in-the-server-directory

    A creative solution could be to periodically open your c3p with a zip program and copy the .c3proj file. At one point in the file it lists all the files in the files folder. You could utilize that to find the folder a particular file is in.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, and I don’t think most would be happy if such a thing was easily possible. Sure it would useful in cases where the author of the game lost the source, but in practice it would mostly be others using it to rip other games.

  • Oh. Sorry, I didn’t read it well the first time. It wouldn’t be a bug and yes the way you did it does fix the frame rate dependence.

    With maxspeed=maxspeed+1 in 1 second at 60fps the maxspeed would increase by 60. At 120fps it would increase by 120 in one second.

    By changing it to maxspeed=maxspeed+60*dt it would increase by 60 in one second no matter the frame rate.

    If the behavior had a rate of change for the max speed it could handle it for you, but it’s a bit unrealistic to handle all cases, so doing what you’re doing is fine.

  • Nothing looks amiss. You use the mouse movement to change the angles. You clamp the up and down angle a bit, it then gets a direction vector from the two angles and uses that for a look at.

    The video doesn’t show much. Do you get the runaway too or just some users?

    If it only happens on some machines then it’s an issue with the mouse movement values perhaps? Hard to debug if you don’t get the issue too.

    I guess you could make a test to log or graph the movement values along with the time. Then maybe nail down down what movements cause the runaway, and record that on both machines and see if there’s anything drastically different between the two.

    Overall if it’s a browser bug with the mouse movement callback then I’m not sure how to correct it. Maybe there’s some creative way to deal with it.

    Nothing else looks amiss otherwise.

  • Don’t use dt and it won’t be.

  • Here's something that you can have that user paste into the browser console. It checks to see if webgl2 and webgl is available and if two extensions are available.

    console.log(document.createElement("canvas").getContext("webgl2")?"webgl2 available":"webgl2 not available");
    gl = document.createElement("canvas").getContext("webgl");
    console.log(gl?"webgl available":"webgl not available")
    if(gl){console.log(gl.getExtension("OES_standard_derivatives")?"pass":"fail");
    console.log(gl.getExtension("EXT_shader_texture_lod")?"pass":"fail");}

    Mine gives this:

    webgl2 available
    webgl available
    pass
    pass

    But overall if webgl2 is available, or webgl and those two extensions are available, then it should work I imagine.

  • Is that error on your machine or someone else's?

    It looks like on that machine and browser it implements webgl with D3d, and fails when compiling a shader with the tex2Dgrad function. In vanilla Construct the only bundled shader that uses that is the TileRandomization feature for tilemaps which was added in B321. However there appears to be fallbacks in place when using webgl1 and the OES_standard_derivatives extension isn't available.

    Do you use any third party effects? If no, then I imagine a minimal c3p would be one with a tilemap in case that effect isn't automatically added otherwise.

    Best case it's just a slight mistake in checking if that extension is available with webgl1. But considering the error occurred at the D3D level and not the webgl level it may be a browser bug or outdated D3d version. I guess this is a fitting point to ask the browser and version, and what operating system.

  • If they are at the same zelevation the normal 2d overlapping conditions work well. If you compare the zelevation too it’s possible to check for collisions on that axis too.

    Another way is to compare the distance with sqrt((x0-x1)^2+(y0-y1)^2+(z0-z1)^2) <32 which would treat the objects as spheres.

    There are more complex methods, but for now it’s best to skim other posts or examples for working implementations.

  • Well I’m not familiar with those examples and i don’t have access to a mouse so I can’t test for myself.

    Does the issue you’re encountering happen in those examples or just in your game?

    If it’s just happening in yours then somehow you’re not doing it the same. You’ll need to double check to look for any differences.

    If it happens in the examples too then I guess it’s flawed somehow? No idea where. You only posted a partial of how the camera is rotated from moving the mouse.