R0J0hound's Forum Posts

  • Probably too many to list. Math functions and operators are just so you can use any formula you can find. Depending on what you do they all can be used for game dev.

    But as a small example: log is used to convert the sound volume decibels to percent and vise versa. Another use for log is when converting a large number into 10b for example.

    The exact formulas can should be able to be found by a forum search.

  • Hi. The wall collisions are done with signed distance fields (SDF). Basically I just treated each wall as a line segment along the width with a radius of half the height.

    Anyways doing it with the sdf of a box instead is possible too. I just didn’t do it here. Although you can find some other posts where I do sdf collision examples in the meantime.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To record the collision velocity you’d put an every tick event at the end of the event sheet and set some variables from the player’s velocity there. This will give the velocity of the previous frame which is pretty close to the velocity when a collision happens. As you’ve already found out you can’t get the true velocity when you collide since the behavior already resolved it.

    The bounce is unreliable in my example for a few reasons. The bullet bounce action doesn’t always work well, using the previous frames velocity may not be good enough, and the platform behavior may be causing less bounce with how its internal logic works.

    To calculate the normal the most accurate would be a complex algorithm like SAT,Gjk, or Mpr as long as you can access the collision polygons of both. If you can approximate the player as a circle then another good way would be to represent the terrain as a SDF.

    Simpler approximate ways include doing a ray cast in the direction of the velocity before the collision, or sampling points for overlap around the player. Simpler still you could just sample four points around the player to see if you’re on the ground, next to a wall or below a ceiling. Then you could do the bounce if say you’re not on the ground, have a wall to your left and the x velocity is <0. Then you’d do logic similar for a wall to the right or above the player.

    It may also help to reduce the deceleration when in Jetpack mode so the motion is more floaty. There are probably more ways you can fiddle with the platform behaviors settings.

    Another idea which would take more work to do but give more control is to not use the behavior and do the motion with just events.

  • Should work now.

  • There are a few ways you can go about doing the bounce. But since you are using the platform behavior it's easier to work around that.

    Here's one idea. It has a second object with the bullet behavior, that you update the position and velocity from the object with the platform behavior. Then when that bullet behavior object hits a wall, you can bounce and transfer the velocity to the other object. Seems to work reasonably well.

    dropbox.com/scl/fi/vfpccikywdi5itdvn5h4q/platform_bouncy.capx

    It may be possible to have both behaviors on the same object and do some juggling where the bullet behavior is mostly disabled and the platform behavior's velocities from the previous frame are saved into variables.

    You can also cut out the bullet behavior completely and do the bounce calculations directly. You'll still need to save the previous frame's velocities to variables. The main downside is you'll need to get the normal angle of the collisions which is something not provided by construct. There are ways to calculate it but for simplicity it's nice to just use the bullet behavior's bounce.

  • You can do it with something like this. When the player collides with a wall, just compare the y velocity and move the zorder above or below the wall.

    player: on collision with wall
    -- compare player.8direction.vectorY <0
    -- -- player: move zorder in front of wall
    -- else
    -- -- player: move zorder behind wall
  • Offhand the use of trigger once with multiple instances sounds suspect. Idk for sure.

    Something like this should work fine.

    start of layout
    for each sprite
    -- tween sprite to x,y

    Whereas this one will cause trouble. As soon a one tween finishes that sprite alone will move again (or as many that finished that instance). And after that it won't run with and other sprites that finish tweening. The only way to reset it is if none of them are finished tweening.

    sprite: tween is finished
    trigger once
    for each sprite
    -- tween sprite to x,y

    I'm not sure if that's what the tweening aces look like. I haven't used them.

    If you can avoid using trigger once and do something like this instead it would work better.

    [negated] sprite: tween is tweening
    for each sprite
    -- tween sprite to x,y
  • Sounds like you are close. I have found using two Booleans to mark, and then visit the boxes works well for a flood fill like you are after. I use one family to be able to pick different instances at the same time.

    dropbox.com/scl/fi/av1nhfj6kuwgq59g4tdco/connected_boxes.capx

  • Here's one idea. It just takes the current velocity of the player and manually simulates future frames till a wall is hit. Could be further refined to move the landing out of the ground, but as is it seems to work well enough. You can ignore the shadow stuff, was trying a random idea.

    dropbox.com/scl/fi/6r8f40bd7yoqy38bps633/platform_shadows_and_landing_perdiction.capx

  • I don’t have any idea what’s going on there.

    The plug-in is meant to have only one instance and any 3d object creation is done in the same way as the examples. There is no limit to when you can create stuff. I cannot guess how you manage to get it to clip.

  • dropbox.com/scl/fi/6w8o0vdzkalhxl7awjri8/3drotateMesh.c3p

    Here is an example. It builds a rotation matrix from a series of rotations and then applies that to the corners of the quad to do the distort. Since the quad is flat its slightly simpler than if we wanted to handle z too.

    Notes:

    * Project property: "z axis scale" is set to regular.

    * The object's size is set to 1x1 and we set the size from the scale function.

    * Distort points can't have a z<0. So to work around that we set the zelevation to -1000, and add 1000 to the zelevation of the distort points.

  • Sounds like you just want to rotate the distort mesh around some other axis besides the z axis like setting the angle does.

    You can search the forum for “rotate around a point” or “rotate around x axis” to get you the math involved. Search posts by me for 3d rotation and I think there’s some examples too.

    The math involved is just taking the corner points and multiplying each one by a rotation matrix. Ideally it would only need to be an 2d rotation which simplifies the math. Alternately you could multiply them by a rotation quaternion. Anyways, just some ideas where to look to get a possible solution. At least till someone can make and example.

  • So all you’re doing is creating icons and text on buttons when they are created depending on some Boolean instance variables?

    Any reason why the text is pulled from an array instead of just being put in an instance variable of the button?

    Here’s a possible way you could do it.

    button: on created
    -- button: boolTextVisible
    -- -- create text at button
    -- -- text: set text to button.text
    -- button: boolIconVisible
    -- -- create icon at button
    
    on clicked on button
    -- call shimmyAndShake
  • Look at the local storage plug-in. That’s persistent storage. It’s also possible to interact with a server to store files there. But that’s probably overkill. Also if you use desktop export you can actually read and write files.

  • Probably best to create a new topic asking about Q3d since I’ve never used it and don’t have it. That would give better visibility for anyone who actually use/used it.

    With this plug-in you can’t access vertex positions. What you can do is make another object and position it relative to another object. So if you know the original vertex position (say 1,2,3) you can position and object to that but use the relto field to be the other object that’s rotating.

    Anyways, just a possible solution idea. I haven’t been on a computer for months so I haven’t tested this.

    For the second question, I don’t have a capx. The post I made seems sound. Guess you could do it with the move at angle action too.

    Sprite2: set position to center

    Sprite2: move 100*cos(10*time) pixels at angle center.angle

    Sprite2: move 50*sin(10*time) pixels at angle center.angle+90

    Anyways, you probably would get better help with a new topic. There are a lot of users that have the time to check what the issue with your capx could be. Or they could give their own solution with more support than I can currently give. I only offer solutions off the top of my head lately. All I can guess is if it’s working for one object and not the others is the other objects aren’t using the same code or you’re overlooking some picking aspect or something.