R0J0hound's Forum Posts

  • Html5 and JavaScript is what the engine is made in. But as a user you are typically using the event sheet to do the logic with the option to use some JavaScript.

    So unless you’re using some JavaScript you’re just programming with construct’s event sheet which isn’t JavaScript.

  • It's similarly complex. It's just different.

    dropbox.com/s/4y4dfpj5fx2xwna/piano_record_test.capx

    And, no, I'm not that good at piano.

  • That's close to what I meant. I think the 8direction behavior just gets in the way.

    The 8direction behavior already limits the speed to the maxSpeed so all you need to do should be:

    1. set velocity of x and y to 0.

    2. when a direction key is pressed add to the velocity a direction vector:

    maxSpeed*cos(a), maxSpeed*sin(a)

    That should handle diagonals and such, unless something I'm not aware of occurs in the behavior.

    An alternate idea is to have a hidden object with 8dir that you move normally but without collisions. The rotate that object's velocity and set the velocity of a visible object. It would give smoother speeding up and slowing down, but it still wouldn't update the velocity when hitting solids.

    dropbox.com/s/v41o4p8qxsd5tdh/rotated_8dir.capx

    Or here is an older example of the 8dir behavior done with events sans collisions. You just set the angle of the sprite and motion will be relative to that.

    There may be a simpler way. I guess I didn't really answer your question. But having a few example of various ways to do it could be useful?

  • First the distance(0,0,vx,vy) is correct. Vx,vy is the velocity vector and that gets the magnitude of that vector. For velocity the magnitude is the speed. You can also calculate it with sqrt(vx^2 + vy^2).

    Anyways for motion logic you’d set vx and vy to zero and just add any directions you want.

    The final step is to limit the speed to a max speed.

    Here’s another possible way to do it. I mean you can apple the speed of 100 as a last step.

    every tick
    -- vx=0
    -- vy=0
    
    if up pressed
    -- set a to player.angle
    -- add cos(a) to vx
    -- add sin(a) to vy
    
    if right pressed
    -- set a to player.angle+90
    -- add cos(a) to vx
    -- add sin(a) to vy
    
    ... etc for other directions
    
    if vx<>0 and vy<>0
    -- set mag to sqrt(vx^2+vy^2)
    -- set vx to 100*vx/mag
    -- set vy to 100*vy/mag
  • You can find a list of words in a file online. You can then parse and load them into construct.

    construct.net/en/forum/construct-3/how-do-i-8/store-check-english-words-168954

  • Looked in your file briefly. I don’t have a whole lot of feedback other than it’s very different than what I did in my capx.

    I tried to move all the logic in the click function. Yours has it multiple places.

    In mine it doesn’t refer to the mouse or touch at all in the click function. The idea is that function is called for every click xy. Can be modified for touch xy as stated in my previous reply.

    Sounds like you may just want to record the keys instead. Just the time a key changes to pressed from not pressed and vise versa. You wouldn’t have to worry about recording input then and you’d have more freedom with using any input events you like.

    Anyways, just some thoughts.

  • You can set the velocity in a specific direction with a bit of trig:

    Vx=100*cos(a)

    Vy=100*sin(a)

    You can also combine two velocities by adding them.

    Vx=100*cos(a)+100*cos(b)

    Vy=100*sin(a)+100*sin(b)

    Then to limit the max speed you can do this

    Speed=distance(0,0,vx,vy)
    If speed>maxSpeed then
    — vx = vx/speed*maxSpeed
    — vy = vy/speed*maxSpeed
  • You can set the velocity in a direction with

    a = angle(sprite.x, sprite.y, mouse.x, mouse.y)

    Set velocity to 100*cos(a), 100*sin(a)

    Impulse is more like adding to the velocity so that could be done with:

    Set velocity to sprite.platform.velocityX+100*cos(a), sprite.platform.velocityY+100*sin(a)

    Or something like that. I may have the names wrong.

    For either 100 is the strength of the impulse.

  • I mean you can fiddle with the collision more. It may work better if the ball has a box collision and isn't rotated at all. You can use the "set angle of motion" to let you shoot where you aim.

    If the bullet behavior's bounce still isn't acceptable you can use the physics behavior instead to move the ball. Give the tilemap and the ball the physics behavior, make the tilemap immovable, and when you launch the ball you'd set it's velocity with:

    set velocity to (speed*cos(angle), speed*sin(angle))

    You may need to fiddle with some of the ball's physics properties to tune it. Stuff like collision shape and elasticity. You may need to disable collisions between balls or change the gravity with events.

    If that still isn't satisfactory you can calculate the surface normal of a collision and do the bounce with math. Here it bounces a perfect ball with a tilemap. This gives more control but isn't as simple to drop in.

    dropbox.com/s/r7ptcicrw0k753w/bounce_sdf.capx

  • I don't understand what you mean by multiple sprites. The capx records and plays back clicks.

    I guess touch would be slightly different but if you chnage it to touch it will work for multiple touches.

    Event 6

    Just use "on tap gesture" instead of "on click", and use "touch.x/y" instead of "mouse.x/y"

  • You could also change the bullet behavior property to not set the angle of the object when it’s moving. It would make the collisions more consistent.

  • There are the layertocanvas and canvasToLayer system expressions that may help there. At least when the object on the 3d layer has a zelevation of 0.

  • Changing the sprite size or changing the animation frame makes the physics object's shape get destroyed then recreated and that gets delayed till the end of the frame which makes it lose forces/velocity. It's either intentional or an oversight of not transferring the forces to the new object. It's been like that since the physics behavior was made so maybe a bug report could get that corrected.

    The mass property in construct's editor should be labeled as density. The area of the shape changes what the mass is.

  • You probably have to reach out to the developer of that addon since if it doesn't work when exporting it's something they have to correct:

    construct.net/en/construct-2/addons/410/simplethree/documentation

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's one idea:

    dropbox.com/s/5qdydncdpj1c1jl/clickRecordPlayback.capx

    Basically have your touch/click events call a function and do all your click logic there. That way you can also just call that function when you want to simulate a click.

    The second part is recording and playing the clicks back. You'll need the time the click happened and where it happened (x,y). You'd then store that in an array.

    Anyways, you can look at the capx to see if that's something you can work with.