R0J0hound's Recent Forum Activity

  • One idea to avoid the trees being clumped too much is to use a single nextSpawn timer for all of them. That would let you specify the min time between trees. You’d just have to rearrange things so a random tree sprite is created.

    The other idea to only allow trees to be places so that it is actually possible to jump over is much harder. A rough idea would be to simulate the path of the player jumping and see if it can clear the trees and land. Might be able to simplify that with a calc of how far before a tree you have to jump and where you’d land after, then combine them somehow. Probably would need to add some tolerances to allow for reaction time and variance from the engine. Anyways could be a rabbit hole of ideas to try.

  • Is it just a straight line between A and B?

    If so you can limit another objects position between them with:

    T=clamp(((b.x-a.x)*(sprite.x-a.x)+ (b.y-a.y)*(sprite.y-a.y))/((b.x-a.x)^2+ (b.y-a.y)^2),0,1)

    X=lerp(a.x,b.x,t)

    Y=lerp(a.y,b.y,t)

    That formula is a vector projection.

    If the path isn’t straight then you’ll have a series of lines. For that you’ll need to incrementally find what line segment to limit the sprite’s position to.

  • Here’s one way. You can change the camera code but it relies on the forward vector which is only set by the look at action.

    One touch changes the camera and a second touch tosses a tomato.

    dropbox.com/s/cd5gad46nqx49sd/Tomato_toss.c3p.zip

  • I mean there aren’t that many 3d features available in construct so trying to do anything beyond the obvious features will be more involved if possible at all.

    For example even throwing a tomato in 3d becomes an involved multi part problem. Construct doesn’t really provide anything that would make it easier.

    1. The tomato would need to be a sprite or a mesh. If a sprite you’d probably want to use a distort mesh so that you can have the sprite always face the camera. But only if the camera is set with the look at action. The camera rotate action makes it harder. Then if 3d there’s the problem of the limited number of 3d shapes. For that you’d either need a third party 3d plug-in, or do some trickery with distort meshes.

    2. To move the tomato we’d need to do the physics from scratch. None of the behaviors will help here.

    Off the top of my head the motion and basic ground plane collision detection would be this:

    Every tick
    — add gravity*dt to vz
    — set x to self.x+vx*dt
    — set y to self.y+vy*dt
    — set z to self.z+vz*dt
    
    Z<0
    — destroy

    To launch you’d set the starting z position, then set the velocity (vx,vy,vz) to the camera’s forward vector times some speed.

    Anyways as you can see there is math involved. And the names of things are different in construct. Like zelevation instead of z. Plus you’ll want to set the project z scale from normalized to regular.

    I know an example would be ideal but I feel like I’m re figuring out how to do it every time. As is it’s hard to just drop an answer without an example and have it be clear how to implement that into construct.

  • If you add a variable t to the pillar then you could do something like this:

    On bullet collides with pillar
    — pillar: set t to 0.5
    
    Pillar: t<=0
    — pillar: set y to self.y-50*dt
    
    Pillar: t>0
    — pillar: subtract dt from t
    — pillar: set y to self.y+75*dt

    With that it will go up at 50 pixels per second. Once it gets hit it will go down at 75pixels per second for 0.5 seconds. You can change all the values.

  • I agree it would be tedious to make the collision shape manually and it would be hard to get it to be smooth.

    But you can use mesh distort to make any shape you want. For example this takes a square sprite and makes it into a circle. Even with just 20 points it's decently smooth. Typically you'd make that invisible and put the sprite you want for a visual on top.

    dropbox.com/s/rxruw0ke7ox9uo5/collision_shape.c3p

    The second part of that example loads the outline of a mario sprite.

    You can use this tool to create the point list.

    dropbox.com/s/ldpsgtgzxwuajfc/marchingSquares2.c3p

  • Guess it’s better than nothing. My main complaint is its solution didn’t give something working. You had to modify it a lot.

    At least the formula was probably useful. It basically is a way to move by an angle and it is one of the main uses of trigonometry for games. But then again construct has the move at angle action which could be used instead of the math.

    The problem I see with more complex problems is having to see if the solution is correct. If you have to modify it heavily like removing the angleToRadians expression and such then it’s not helpful.

    But I can see the value of it giving some ideas of where to maybe start.

  • It won’t affect performance one way or another. Using something else is just to organize things.

  • By default the color components go from 0-100 not 0-255.

    Use (0, 100, 102/255*100)

    Or use one of the other rgb expressions that take values 0 to 255.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In construct 3 if you make the function return a value it won’t show up in actions but it will show up in expressions.

  • Functions are simply a way to re-use chunks of events. They are only run when you call the function.

    Triggers can be thought of as functions. If it helps some things like input are probably checked regularly like non triggers but that check is done at some lower level point in the system. Like mouse clicks are checked in the mouse driver, which is taken by the operating system, sent to the browser, which loops over the events and sends them to the js event listeners, which in turn is handled by construct’s engine.

    Other triggers come from checks in other places. For example on frame changed comes from the sprite objects tick function which updates the frames. There it calls the trigger when the frame changes.

    Some things are so called fake triggers, but that’s mainly a term in the sdk. There aren’t too many examples of them, off the top of my head on collision, gamepad triggers, timer triggers, and I want to say in the Los behavior. It’s more of an exemption to the rule, and they act like a normal event with a trigger once.

    In collision is interesting since it’s both a fake trigger and a real one. It’s kind of like an is overlapping and a trigger once but it’s done per instance It’s also a normal trigger because the physics behavior calls it when the physics engine has a collision.

    Anyways, functions are just a way to organize and reuse code.

    In general you can think of triggers as functions that don’t run every tick, and instead are called by other parts of the runtime. But like many parts of the engine there are exemptions where things may work differently.