R0J0hound's Recent Forum Activity

  • It was intentionally missing. Probably could be reworked without it.

    That’s fair. I can only approximate events with text, and I was only mentally working it out. I’ll see if I can make a capx of it eventually. Might have to defer to other people’s ideas in the meantime as I have no eta when I’ll lay aside time to make one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Gdevelop expressions look overly verbose. Anyways, I’m not sure the question.

    The math of positioning an object with a distance and angle from another object is the same no matter the program.

    X = centerX + dist*cos(ang)

    Y = centerY + dist*sin(ang)

    Or since you know the object you want to move toward you can skip the trig altogether.

    mag = distance(centerX,centerY,mouse.X,mouse.Y)

    X = centerX + dist* (mouse.x-centerX)/mag

    Y = centerY + dist* (mouse.y-centerY)/mag

    Although you could use the move at angle or move forward actions to do that too in construct.

    Sprite: set position to (centerX,centerY)

    Sprite: set angle toward position (mouse.x,mouse.y)

    Sprite: move forward dist pixels.

    There are likely other ways too. My answers are construct centric.

  • Right. You have to loop over it in multiple passes. Once to find the 1s and another for the rest.

     var i
    var j
    repeat a.width times
    -- set i to loopindex
    -- compare: a.at(i) = b.at(i)
    -- -- a: set at i to "-"
    -- -- b: set at i to "-"
    -- -- c: set at i to 1
    
    repeat a.width times
    -- set i to loopindex
    -- compare: a.at(i) = "-"
    -- -- 
    -- else
    -- -- set f to b.indexOf(a.at(i))
    -- -- compare f = -1
    -- -- -- c: set at i to 3
    -- -- else
    -- -- -- a: set at i to "-"
    -- -- -- b: set at f to "-"
    -- -- -- c: set at i to 2
  • If you’re okay with the two arrays getting destroyed this should work on paper. You could always save the asjson of arrays A and B to save them. This assumes all the arrays have the same size.

     var i
    var f
    repeat a.width times
    -- set i to loopindex
    -- compare: a.at(i) = b.at(i)
    -- -- a: set at i to "-"
    -- -- b: set at i to "-"
    -- -- c: set at i to 1
    -- else
    -- -- set f to b.indexOf(a.at(i))
    -- -- compare f = -1
    -- -- -- c: set at i to 3
    -- -- else
    -- -- -- a: set at i to "-"
    -- -- -- b: set at f to "-"
    -- -- -- c: set at i to 2
  • Sure you could use imaginepoints too. There are probably other ways to get a point to rotate around

  • I don’t think you can change it even with js. The origin is tied in with the frame which is shared between instances.

    You can rotate around an arbitrary point cx,cy by and angle a with

    sprite: setpositiom to (cx+(self.x-cx)*cos(a)-(self.y-cy)*sin(a), cy+(self.x-cx)*sin(a)+(self.y-cy)*cos(a))

    sprite: rotate clockwise a degrees

    You could pin another sprite on the sprite to be the center to use for cx,cy

  • You could do this:

    random(1)<0.25?int(random(10,25)):int(random(25,50))

    The 0.25 means

    10-25 has a 25% chance

    And 25-50 has a 75% chance

  • So I can think of two ways to do it. Pixel/tile based or polygon based. Polygon based would scale up better with higher resolutions, and pixel/tile based is simpler but is slow. Especially with higher resolutions.

    Here's a test of the tile based method with construct's tilemap.

    dropbox.com/s/v81su1aeaddh35y/qix_test.capx

    My intention with this as with most capx files I post is just to give ideas.

  • I agree. That would be useful.

    To set the overall velocity you’d have to do something like:

    Set velocity to

    100*cos(angle(0,0,self.physics.velocityX, self.physics.velocityY)),

    100*sin(angle(0,0,self.physics.velocityX, self.physics.velocityY))

    Where 100 is the speed you want to use.

  • Sorry. No ideas yet. Haven’t been on the computer.

    Any idea is probably feasible. I’d need to dissect that capx to see what I did to comment on any ways to modify it.

    On face value all the cars need to do is move along the roads, queue up at intersections, and have some logic to let them go though intersections in an orderly fashion.

    I’d have to work it out on paper, then find a way to make it into events. Depending on how I decide to do it some quirks of the event system need to be taken into account.

    Sub-problems to solve include moving the cars smoothly, handling different speeds, testing for edge cases and such.

    I’ll post if I get anything working.

  • You can do a flood fill to do that.

    Basically mark all the tiles as not visited and then start with some tile and flood fill from that. Marking all the connected tiles. At the end any tiles not marked are isolated.

    I guess the issue would be choosing which tile to start from. Maybe an edge? Depends on what you want to do.

  • You can use a sprite with a 2x2 distort mesh to do that.

    Set the project properties to standard z scale.

    Make the sprite of size 1x1.

    The set the mesh points to the triangle corners. Two of the mesh points would have the same positions so the quad would collapse into a triangle.

    For more efficiency you could try to do two adjacent triangles with one quad, but that’s not always possible.