R0J0hound's Forum Posts

  • What is it?

    A new physics behavior that uses Chipmunk Physics instead of Box2d. It's built on a JavaScript port found here: https://github.com/josephg/Chipmunk-js which is based on Chipmunk2d 6.1.1.

    It differs from C2's physics behavior in a few ways. For instance this behavior works when you manually set positions at runtime and you don't have to wait a tick before adding joints. Also the Warp behavior will work with this one without a hitch. Another difference is when adding joints you use an object uid instead of picking the other object, which simplifies adding joints between instances of the same type.

    Features:

    * Collision shapes: None, Box, Circle, Polygon and rounded Segments. (Segments can't collide with other segments)

    * Support for concave polygons.

    * Support for tilemap object.

    * Standard object properties: Mass, Elasticity and Friction which can all be set at runtime.

    * Collision filtering:

    1. Collision groups that allow objects not to collide with other objects in the same non-zero group.

    2. Collision layers which is basically 32 different layers, and the object can be in any number of them, and will only collide with objects that share a layer.

    * Additional expressions: inertia, center of mass and area.

    * Every joint chipmunk2d has to offer is available to use. http://chipmunk-physics.net/release/ChipmunkLatest-Docs/#cpConstraint-Video

    * Ability to specify where on the object's the joints are attached.

    * Ability to destroy individual joints, get the current impulse applied to a joint, and get the number of joints an instance has.

    * Global properties: Damping, Iterations, fixed timestep, and Gravity.

    * Ability to set and get: Velocity, angular velocity, force, impulse and torque.

    * All actions that set force, impulse, velocity, gravity, etc,... can be set with an xy or an angle and magnitude.

    * Force and impulse can be applied to an offset on the object.

    * Collision info with the "Post Collision" condition. With it you can get:

    1. Kinetic energy of collision.

    2. Impact of a collision.

    3. UID of other chipmunk object hit

    4. Number of contact points and the point, normal and penetration depth of each.

    * Closest point and Segment ray casting with expressions to get the point, distance, and normal with ray-cast.

    * Utility expressions to convert coordinates from layout (world) to local (relative to the body) and back.

    * Ability to set speed limits to objects and force limits to joints.

    * Chipmunks automatic object sleeping with actions to manually put to sleep and wake up.

    • As well as global properties to set the "idle speed threshold" and the "sleep time", which is the time idle before going to sleep.

    Download:

    https://app.box.com/s/jt9f8r1mqmq07pbthiydvrgzikp5d29f

    To install extract zip file into "C:\Program Files\Construct 2\exporters\html5\behaviors".

    Simple joints Example:

    https://www.dropbox.com/s/glddumkw3mt64 ... .capx?dl=0

    Conditions:

    Actions:

    Expressions:

    -cheers

  • DrewMelton

    If you set the layout width to 6000 and change the x expressions in events 37,38 from "(map.CurX-map.CurY)*75" to "(map.CurX-map.CurY)*75+3000" then the minimap will be more centered. You can do something similar for the vertical space.

  • DrewMelton

    I compared your capx to the original cap and found the issue.

    In events 7-10 you need to change the "miner.CurX" expressions to "miner.At(0)" or "miner.At(1)" like in the CC cap and it works.

  • I can't open the capx at the moment but you'll have to tweak your array events slightly.

    Construct classic arrays are 1 based so to access the first element you'd use

    Array(1)

    Array(2) for the second and so on.

    C2 uses 0 based arrays, so the expressions to access the first two elements would be:

    Array.at(0) and array.at(1)

    So I think if you subtract one from the array indexes throughout your capx it should fix it.

  • DrewMelton

    I'd go for using separate animation frames rather than separate objects.

    Here's a bitwise example here that uses the tilemap instead of array, but the concept is about the same.

    tilemap-auto-tile-help_p721581?#p721581

    I had a bit of a go at making an example in isometric. Art is time consuming for me and I wasn't able to find a free tileset that has all 16 combinations required for the bitwise method. I was able to use a modified approach with what I could find though.

    http://opengameart.org/content/cave-tileset

    https://dl.dropboxusercontent.com/u/542 ... tile3.capx

    I also found a useful general reference on isometric here that may be helpful:

    http://gamedevelopment.tutsplus.com/tut ... medev-6511

  • round(var*10)/10 should work for rounding to the nearest tenth.

  • For the first question it's pretty simple, just add a condition to check for when the score is 5 then add an action to set the bullet speed to 500.

    For adding 100 to the speed every 5 seconds you could make an every tick event with an action to set the speed with the expression:

    int(score/5)*100+initial_speed

    Where initial_speed is whatever the bullet speed started at, or rather what speed you want it to start at.

  • I haven't used that plugins so I can't be of help there. I do have a capx where I did chess movement without any third party plugins. It perfectly generates all legal moves for any piece selected, minus moves like en passe and castling. So in short it's a different way to do it but likely not an easy or better.

    https://dl.dropboxusercontent.com/u/542 ... chess.capx

    But I'm sure rex has a way for it to work with his plugin.

  • Forget about isometric for a moment and look at doing it only in 2d. Isometric can be added later easily enough with the only headache being perhaps sorting.

    The simplest kind of procedural generation is done on a 2d grid. This can be represented by a 2d array which will provide a value for each grid position. Next you as the designer need to choose what the values mean.

    For a continent type you could use say 0 for water and 1 for land. For a dungeon you could use 0 for floor and 1 for walls. It just all depends on what you want to generate. Also there is no reason why you couldn't use 2,3... and so forth for more terrain types, again it depends on what you want to do.

    Note at this point we just have a data representation of the map. If we want to get a visual of it we need to loop over the array and create objects at those positions.

    For example if each tile is 32x32 pixels and the tile's origin is in the center then you can create the map with an event like so:

    Array: for each xy element
    --- Array: current value = 0
    ------> System create water on layer 0 at (Array.CurX*32+16, Array.CurY*32+16)
    --- Array: current value = 1
    ------> System create ground on layer 0 at (Array.CurX*32+16, Array.CurY*32+16)[/code:y0phpsp3]
    
    Or if your sprites are isometric then you can do this.  Note: a 32x32x32 isometric cube will have a 64x64 pixel image.
    [code:y0phpsp3]Array: for each xy element
    --- Array: current value = 0
    ------> System create water on layer 0 at ((Array.CurX-Array.CurY)*32+320, (Array.CurX+Array.CurY)/2*32+16)
    --- Array: current value = 1
    ------> System create ground on layer 0 at ((Array.CurX-Array.CurY)*32+320, (Array.CurX+Array.CurY)/2*32+16)[/code:y0phpsp3]
    
    Well, then on to more about the generation.  The most simple generation other than setting all the array to one value is to set each value to be randomly 0 or 1.
    [code:y0phpsp3]Start of layout
    Array for each xy element
    ---> Array: set value at (Array.CurX, Array.CurY) to choose(0,1)[/code:y0phpsp3]
    
    Beyond that there are a lot of different ways you can generate the maps.
    
    Instead of set setting individual grids you can set horizontal or vertical lines and filled rectangles by using "for loops".  
    
    For terrain you can use the "noise" addon which will give nice perlin noise instead of staic noise.  I've also used a smaller separate array and interpolated it onto the larger array for a more globular noise. 
    
    For the wall bit do a search for "bitwise" for a method to choose a image based on what's around it.  It also can be used for the water shoreline.
    
    To have a land mass that doesn't have any inaccessible areas there are basically two ways to go about it.  One is to pick a spot with land and do a "flood fill" there to mark anything connected and then check for values of land that isn't marked.  A second method is to only grow from existing land so you always know it's connected.
    
    Another topic to look up is "cellular automata" which can be useful at times.
    
    cheers
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You do not have permission to view this post

  • You'd have to reset sum to zero before every calculation. As a more complete example you could put it in a function so you could calculate xp() from anywhere with for example function.call("xp", 20).

    global number sum=0

    On function "xp"

    ---- set sum to 0

    -------- for "n" from 1 to Function.param(0)-1

    ------------ add 75*2^(loopindex/7) to sum

    -------- every tick

    ------------- function: set return to sum

  • WindowWidth and WindowHeight give the pixel size of the view. With "fullscreen in browser" set to "off" the values will be identical to the viewport size.

  • Savvy001

    The tilemap plugin won't draw anything that's offsceen, which is why only a window area is drawn. One idea could be to set the window/viewport size to be the same as the layout temporarily before pasting.

  • You'll have to do it with a loop. Something like this:

    global number sum=0

    for "n" from 1 to L-1

    --- add 75*2^(loopindex/7) to sum

  • Irbis

    I don't notice any jump, but I guess it depends on what you did.