R0J0hound's Recent Forum Activity

  • It’s working as expected. In mine it sets the values based how A matches B.

    You’re looking at how B matches A.

  • I’m always trying to find ways to simplify the events if I can.

    Another idea instead of the Booleans is to use a dictionary. I’ll call the dictionary “pairs”. Nice way to use less variables, probably faster for a large amount of objects. The only downside is it doesn’t handle if multiple A or multiple B have the same matchId. But that may not be an issue if that can’t happen.

    for each A
    -- pairs: add key A.matchId with value A.uid
    
    for each B
    -- pairs: has key B.matchId
    -- -- pairs: remove key B.matchId
    -- else
    -- -- B: destroy
    
    pairs: for each key
    A: pick by uid pairs.curValue
    -- A: destroy
    -- pairs: remove key pairs.curKey
  • Cool, glad it was useful.

  • I had no idea what game tag you were referring to. Google linked to a game on the arcade. Looks like the camera centers between the players and zooms so all players are visible at once even when far apart.

    So here's how you'd do it for two sprites. 640,480 is the window size. Find the width and height of the bounding box that contains all the players. You can add to this so there is space around the players. Next you scale the layout. Here it's limited to 1 so it will only zoom out instead of zoom in too. Lastly scroll to the midpoint between the players. For that step you can just give the sprites the scrollto behavior instead.

    w= max(palyer1.x, player2.x)-min(palyer1.x, player2.x)
    h= max(palyer1.y, player2.y)-min(palyer1.y, player2.y)
    set layout scale to max(1, (w/h> 640/480)?640/w:480/h)
    scroll to ((player1.x+player2.x)/2, (player1.y+player2.y)/2)

    For three sprites you can change the calculation to:

    xmin = min(palyer1.x, player2.x, player3.x)
    xmax = max(palyer1.x, player2.x, player3.x)
    ymin = min(palyer1.y, player2.y, player3.y)
    ymax = max(palyer1.y, player2.y, player3.y)
    w= xmax-xmin
    h= ymax-ymin
    set layout scale to max(1, (w/h> 640/480)?640/w:480/h)
    scroll to ((xmin+xmax)/2, (ymin+ymax)/2)
  • 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.

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.