R0J0hound's Recent Forum Activity

  • You’d have to do it manually. Ideally there are expressions to get the position and such I’d the joints. Or if not you could save the values when you add the joints.

    Then you’d just position sprites or use a drawing plugin to place lines and stuff

  • The capx is working here. I don't know what's amiss.

    Here's basically the events. It's like my previous post, and it does what you're describing. The minimap is centered on the player and is scaled down from the level size. It creates markers from everything, but if you only want the buildings close, you can add another condition to the for each loops like:

    distance(building.x, building.y, player.x, player.y) > 200

    every tick
    -- destroy playerMarker
    -- destroy EnemyMarker
    -- destroy BuildingMarker
    -- create playerMarker at minimap.x, minimap.y
    -- playerMarker: set size to player.width/10, player.height/10
    -- playerMarker: set angle to player.angle
    
    
    for each building
    -- create buildingMarker at minimap.x +(building.x-player.x)/10, minimap.y + (building.y-player.y)/10
    -- buildingMarker: set size to building.width/10, building.height/10
    -- buildingMarker: set angle to building.angle
    
    for each enemy
    -- create enemyMarker at minimap.x +(enemy.x-player.x)/10, minimap.y + (enemy.y-player.y)/10
    -- enemyMarker: set size to enemy.width/10, enemy.height/10
    -- enemyMarker: set angle to enemy.angle
  • The idea I gave should still work. No need to use lerp, and it will automatically center the minimap on the player. This example just maps everything but you can add a distance check before adding things to the map.

    dropbox.com/s/zdtztrfrl4q7p1x/car_streets_minimap.capx

    I also was messing around with some traffic. No behaviors, and a manually laid out road map. Works decently, although the ai seems to have some road rage issues. They seem to like to tailgate, and slow down when someone is behind them, not to mention all the collisions. I was attempting for some more orderly stuff.

    Maybe useful for some ideas.

  • With what you’re saying about prefabs I’d say objects can be kind of thought like that. Just create multiple instances of the same object, and you’ll only ever need one set of events.

    Personally I tend to use as few object types as possible so I don’t have duplicate events if I can help it.

    I’d reccomend reading about picking in the manual. It makes a lot of things fairly easy.

    There are aspects where picking isn’t ideal, such as when created instances can be picked, or wanting to pick two separate instances indavidually, but there are strategies for that.

    Also generally you don’t need to use a list of data. Placing instances and tweaking their variables is the normal way to go about it in construct.

    I guess it depends on what you want to do.

  • I’m on my phone but I may have one idea. Could be vastly different to your project, idk.

    So I’m guessing you have something like this currently:

    Set marker position to minimap.x + enemy.x/32, minimap.y + enemy.y/32

    If the minimap is 1/32 scale

    Relative, just mean subtract the players position from the enemy position.

    Set marker position to minimap.x +(enemy.x-player.x)/32, minimap.y + (enemy.y-player.y)/32

  • There’s this older topic with some ideas. The ones I did I’ve never been super happy with:

    construct.net/en/forum/construct-2/how-do-i-18/creating-top-down-car-traffic-127583

    Best I can tell it involves solving a lot of little problems that together can give the result you’re after.

    * making car follow road. Obeying traffic rules.

    *avoid collisions with obstacles.

    *avoid collisions with other moving cars.

    Pathfinding is too much for this, and it can’t handle moving obsticles. It’s enough to only look ahead a short time in the future. Basically calculate where the cars will be like 10 frames in the future if the stay in the direction they are going, and if they collide then brake or steer now to avoid collision. Seems there are a lot of options here, you could do something arbitrary or come up with something more sophisticated to choose what to do.

    Probably you’d add some events for the cars ai so it can break some of the rules depending on the situation. On example is the pursuing vehicle, it would want to crash into the player car, and maybe wouldn’t mind hiring other cars or walls to do it.

    Speaking of collisions, you’d probably want to use physics instead of the car behavior in this case. The solid behavior isn’t up to snuff for collisions.

    For the Sunday drivers following the road, you can probably just have it decide where to drive as it goes. Mostly just knowing what road section it’s on and what intersection is coming up.

    Out of ordinary stuff would be good to handle too. Like it the car is knocked off the road it may need to backup or whatnot to get back on the road. Or maybe it could need to navigate around cars blocking the road or make excessive maneuvers to avoid reckless drivers. There’s probably a lot of extra finesse you could add.

    Kind of complex overall I think.

    A simplification would be to just think of each car individually responding to its sensors of what’s around it. Could give some interesting divergent behavior.

  • I guess I’ll point out that you didn’t provide enough information. What did you do exactly to get that result.

    Anyways, the issue you’re having probably isn’t because of the math, it’s because the number is rounded a bit when it’s displayed as text. If you manually convert a number to text with str() then it doesn’t do any rounding.

  • Construct only deals with numbers and text. You’ll have to do it via JavaScript. You could make it into a plugin later if you like.

    Anyways it’s a straight JavaScript problem. Roughly you do this.

    1. Create a image

    2. Set the source to the data url.

    3. When it loads, create a canvas, and draw the image to it.

    4. The canvas then has a function to get the image data array.

    I don’t know any of the syntax exactly offhand but it’s something you can find online.

  • Here are some more tests.

    Simple terrain generator. Wrapped it onto a circle to see how that would look.

    dropbox.com/s/tuc8s5u9mi12sz0/terrain_midpoint.capx

    Next I was doing some more tests with distorted quads. Uses Custom Draw plugin, which can be found here:

    construct.net/en/forum/extending-construct-2/addons-29/r0j0hound-plugin-list-135781

    First I was trying various ways to animate various distortions.

    dropbox.com/s/koljyea1m4k9atj/customDraw_test3.capx

    Modified the above a bit. It's a bit cleaner, and you specify the function to use to do the distortion.

    dropbox.com/s/bv721i9d2ucvh4e/customDraw_test4.capx

    Finally here's a 3x3 bezier patch to do the distortions. It's more usable without dealing with math parameters. Seems decent at doing shears, tapers, bends and such. On cool thing you can do is make a square into a circle pretty easily.

    dropbox.com/s/nhmp81cqcwql5az/bezier_patch.capx

  • You can do it the same way as you did with one instance with else’s. Just add a “for each blue” event and put the events you used before as sub events. That way it will only be looking at one blue instance at a time.

    “For each” is usually the solution when something works with one instance and you want to make it work with multiple.

  • You can use lerp in a different way as well to do the motion at a constant speed.

    You can do it with a t variable.

    Every tick
    — set t to min(1, t+dt/duation)
    — set x to lerp(startx, endx, t)
    — set y to lerp(starty, endy, t)

    It will move from a start position to an end position in “duration” seconds.

    Basically that’s what the easing behaviors do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That’s a c2 effect. It would have to be ported to c3 to use, and then it’s just a matter of using it.

    Other than that there’s a broad amount of ways to fake 3D. You can google search the forum to find quite a few examples over the years.