R0J0hound's Forum Posts

  • You can use equations like the following if you're using physics equations

    http://en.wikipedia.org/wiki/Orbital_sp ... ital_speed

    There are some capx here:

    how-do-i-set-up-an-span-class-posthilit-orbit-span-using-physics_p855815?#p855815

  • Lerp (a, b, t) as an equation is:

    a+t*(b-a)

    Clamp(a,b,c)

    Just takes a value "a" and limits its value to between b and c

    This is all that clamp does:

    If a<b set a to b

    If a>c set a to c

  • Well you first can calculate the percentage of mouse.x across the screen with:

    percent = mouse.x / screen.width

    When percent= 0 you want bar.x = 0

    and when percent = 1 you want bar.x = screen.width - bar.width

    This is assuming there is no scrolling going on and the origin of the bar object is on the left.

    You then can use lerp to set it up:

    bar.x = lerp(0, screen.width - bar.width, mouse.x / screen.width)

    You may also want to clamp the percent value so it stays in the range of 0 to 1 like so:

    bar.x = lerp(0, screen.width - bar.width, clamp(mouse.x / screen.width, 0, 1))

  • mattb

    In event 21 you use the loopindex expression and the "for each collision pair" doesn't set it to anything, so the contactpointX() expessions will always return 0, since loopindex defaults to -1 when not in a repeat, for, or "for each sprite" loop. Each collision pair can have more than 1 contact point so adding a repeat Player.Chipmunk.ContactCount times condition to event 21 will help.

    Pin joints aren't like the pin behavior. They are a rod connecting two objects. So when you add the joint the distance between the anchor points are kept. See the js demo of it here:

    https://dl.dropboxusercontent.com/u/249 ... oints.html

    According to the chipmunk forums the way to join two objects together is with two joints. A pivot and a gear joint. I apologize fo the seeminly complicated formula used for the phase of the gear joint. It's the signed angle difference between the two object angles. angle(0,0,cos(a-b),sin(a-b))

  • When setting the force use polar instead of rect and use the angle() expression to get the angle.

  • Pick by uid is a direct way to pick a particular instance. You could use a 2d array and store the uids of the objects on the respective grid. That way you can have the same advantage as a tilemap.

    Basically you can organize them any way you want and store them in an array for quicker access.

  • For 2d you can just use the distort map to bend the road in curves. For 3d the problem of using a textured road and placing objects becomes a full 3d one except the math has to be done yourself. You can use z with distort maps so the drawing capabilities are there. To position objects you'll have to set the zelevation on sprites as I recall.

    About the curving in the example, that's all it is. I never refined it to look right.

  • Picking with sprites has to check all the currently picked sprites. Tilemap tiles on the other hand aren't picked, you select them directly based on tile location.

    I don't quite follow your description but if you have a "for each" which calls a "for each" with no "pick by evaluate" and 4000 instances you'll get 4000*4000 iterations. With picking you'll get much less depending on what's picked. On another note picking is run over all the picked instances so an event by itself that uses "pick by comparison" will have to run the comparison on all 4000 instances, and since functions reset picking, each time it's run 4000 comparisons will have to be made. So again a total of 4000*4000 comparisons.

    Tilemaps don't do picking on tile. Checking any tile only takes 1 check. It can be refered to as a spacial hash.

    overall sprites can be anywhere so you need to loop over all of them to find one in a specific spot.

    Tiles are in specific spots so you can just check that spot to find the tile.

  • The 3d effect can be done like in here:

    For just curving sprites in 2d you can use distort maps.

  • That doesn't look like a plugin. Look in the other plugin folders to see what files a plugins is expected to have. The main two files c2 is looking for is runtime.js and edittime.js. If you can't find those files for what you're trying to install then it may not be a plugin.

  • The issue of the wall being a grid is purely a cosmetic one. In the attached capx cells are even positions in the array and walls are odd. After the maze is generated I loop over the cells and choose an animation frame for the sprite based on what walls are around the cell using this equation:

    right + 2*down + 4*left + 8*up

    You could also just as easily create thin walls around the cell depending on what walls are there.

  • Instead of setting the animation frame, you can set an instance variable of each card. Then you can make a boolean variable for each card and call it "face up". If the boolean is true you set the animation frame, and if it's false change the animation to a face down animation frame.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, 1/8th is 12.5% which is 13% when rounded. So one core is being maxed out. Pat finding uses web-workers so do a lot of pathfinding to Engadge the other cores.

  • Here's an example of a way to display the position of cars in a racing game:

  • wouldn't using "pick by evaluate" followed by a "for each" work? Or do you mean the issue of comparing two instances of the same type?

    For the latter, yes you could use an array. One idea would be to pick by evaluate, loop over the picked sprites and store any values you need. Then you loop over them again, checking with the values saved in the array.

    For instance you could do the following to do something for any sprite that has another 32 pixels to it's left.

    pick by evaluate

    --> set array size to (pickedCount, 3, 1)

    -- for each sprite

    ----> set array(loopindex, 0) to sprite.uid

    ----> set array(loopindex, 1) to sprite.x

    ----> set array(loopindex, 2) to sprite.y

    -- for each sprite

    ---- array: for each x

    ---- array at (array.curX, 1) = sprite.x-32

    ---- array at (array.curX, 2) = sprite.y

    ------> do something

    If instead all objects are positioned in a grid you can make it much simpler and faster.

    Start of layout

    --> array: set size to (20,15,1)

    -- for each sprite

    ----> set array(int(sprite.x/32), int(sprite.y/32)) to 1

    pick by evaluate

    for each sprite

    array at (int(sprite.x/32)-1, int(sprite.y/32) = 1

    --> do something

    You'd just need to update the array if an object is moved.