R0J0hound's Recent Forum Activity

  • le Canapin

    map.tileAt() is just getting the tile the projectile's center is currently on, which will almost always be -1 or empty because when it collides with the tilemap only it's edge is touching a tile.

    "on collision" may not be triggered because the physics already resolved the collision and it is no longer overlapping. You'd have to test this to be sure, since I thought that the physics behavior would trigger it directly.

  • heliogame

    The actions you're using to erase/set a tile are using

    Tilemap.TileToPositionX(loopindex("tileX"))

    but the actions are asking for tile column and row not layout x and y. So if you change it to:

    loopindex("tileX")

    it works.

  • Yeah, after creation, outside of the same event or sub-events you have to wait till the next toplevel event to be able to pick the new object.

    More details I've compiled in the past. CC did it too.

  • Arrays have a load action so you can do this:

    Array2: load from array1.asJSON

  • All the plugin does is load an url. Any caching is completely out of it's control as far as I know.

  • Personally I hate populating arrays one at a time like that. Also is the id just +1 from the array index at all times? I'd make a function to initialize in a cleaner way.

    Start of layout

    function call "initGun" (1, 10, 400, 1)

    function call "initGun" (2, 5, 400, 1)

    function call "initGun" (3, 40, 300, 3)

    function call "initGun" (4, 100, 200, 10)

    On function "initGun"

    GunArray Set value at (function.param(0)-1, GUN_ID) to function.param(0)

    GunArray Set value at (function.param(0)-1, DAMAGE) to function.param(1)

    GunArray Set value at (function.param(0)-1, SPEED) to function.param(2)

    GunArray Set value at (function.param(0)-1, FIRE_RATE) to function.param(3)

    And you can also make a comment by adding another parameter that you don't use. ex:

    Start of layout

    function call "initGun" (1, 10, 400, 1, "pistol")

    function call "initGun" (2, 5, 400, 1, "rifle")

    function call "initGun" (3, 40, 300, 3, "shotgun")

    function call "initGun" (4, 100, 200, 10, "pea shooter")

    If I had an immense amount of guns I'd go a step further and add a txt file to the project that I'd load and with ajax and parse the data from it with tokenat().

  • Try Construct 3

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

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

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound