R0J0hound's Forum Posts

  • Tested it myself with c2 and c3 and it's sorting correct with that data you're using.

    dropbox.com/s/dz762jh9t0myg9a/array_sort_test.capx

    You'll have to show your project or events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. The mathiest part is the random orientation bit. And the random velocity.

  • An ugly verlet physics die.

    dropbox.com/s/zis7zp6rggxpdny/dice.c3p

  • Cleanest way I can come up with is to also add a Boolean variable to A and B, and do this:

    A: set paired to false
    B: set paired to false
    
    for each A
    B: matchID = A.matchID
    pick B instance 0
    -- A: set paired to true
    -- B: set paired to true
    
    A: [inverted] is paired
    -- A: destroy
    
    B: [inverted] is paired
    -- B: destroy
  • The pathfinder behavior works by dividing the level up into squares and uses the a star algorithm to find the closest path. You can implement a star with events to use a node mesh. This site is a great reference:

    redblobgames.com/pathfinding/a-star/introduction.html

    Looking through my files I found two examples of that. The first is newer, but I included the older one in case that gives ideas.

    dropbox.com/s/v4axhrz8stistdn/astar2_mesh.capx

    dropbox.com/s/p1w0y1qusjp38fu/astar_nodes.capx

    So basically if you used the first one, just place nodes and lines between them to make connections. Then calling the "astar" function with the uid of the start and end nodes will give you a comma separated list of the nodes that would make up the quickest path.

    The latter part of the example gives a possible way to move the object through that list of nodes. There are other ways.

  • Came out like I described, unless I made a typo.

    dropbox.com/s/t2olbf79b3han1q/Array_compare.capx

  • I have no answer for that. You can add the request to the ideas platform and maybe they’ll eventually add it or say doing that with current features is good enough.

    There’s probably a balance between a minimal useful list of actions and a list of every useful function.

  • 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.

  • 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