R0J0hound's Recent Forum Activity

  • link updated

  • Here's and old capx experiment of mine that may give some ideas.

    https://www.dropbox.com/s/df8jtstjva45m ... .capx?dl=1

    The cars don't really follow any traffic laws, they just go while trying to not overlap each other. It can fail when multiple cars enter an intersection at the same time, so some right of way is needed. The hack fix was to make the stop temporary and they'll eventually just drive over each other to keep things going.

  • It's "not equal to."

  • Just update winx and winy when you move the window with events and it will still be able to tell when a user moves it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'd have to test it and see how it performs on mobile. I've only tested the html5 export and I was never concerned with performance tests because this is just a wrapper to an existing js library.

    Also as with any third party plugin/behavior in C2 it won't work in C3 unless it's converted over. No plans to do so though.

  • angle(x1,y1, x2,y2) is the same as atan2(y2-y1, x2-x1)

  • I'm not sure there is an easy solution. You could look into steering behaviors as used in boids for a possible solution.

    You could also take digitalsoapbox's idea to detect what's around the car and then use a state machine to decide what the car will do.

    Like if it is clear in front of the car have it accelerate and drive in the best path.

    If a car is in the way, have the car try to steer around the other. If the other car then slows then have the first car stop overtaking and move to the best path.

    Basically look at what's around the car moment by moment and have states like "overtake" for maneuvers that take longer. It can get as complex as you want.

  • You could also use an array t do this and just store the uid of the object in a grid space (beware one object will have a uid of 0).

    So assuming you set up the level so at most one object is in a grid you could do:

    Start of layout

    --- array: set size to (layoutwidth/32, layoutheight/32, 1)

    --- for each sprite

    ------ array: set at (sprite.x/32, sprite.y/32) to sprite.uid

    so basically if a grid location is 0 it's empty otherwise it's the uid of the object in it. To do movement you'd set the grid of the destination grid to the uid first and then when the sprite arrives there you can set the old position to 0 again. Some instance variables can be used for that.

  • I think it's only doable with nwjs. If you add the nw.js object you can access the x,y position of the window.

    Then to check if it changed you could do

    global number winx=0

    global number winy=0

    start of layout

    --- set winx to nwjs.windowx

    --- set winy to nwjs.windowy

    winx != nwjs.windowx

    or

    winy != nwjs.windowy

    --- set text to "user moved window"

  • The speeds are in pixels per second. So if the speed is 100 the number of pixels moved in a frame is 100*dt.

    Accelerations are similar. If an acceleration of 1500 is used the speed will change by 1500*dt in a frame.

  • Box2d doesn't do that.

    If you want to apply air friction to an object then apply a force in the opposite direction of motion.

    Or you could play around with the linear damping property.

  • Using it as the first condition makes it similar to a "start of layout" condition while not being a trigger. I also can see why you'd use it in the middle of other conditions, although it's a less common use.