R0J0hound's Forum Posts

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

  • It has nothing to do with Construct. It has to do with the power options of windows in which you can set a the cpu speed to be slower to consume less power.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try the Mouse.X("Layer") and Mouse.Y("Layer") expressions with the same layer the minimap is on or just a layer that doesn't scroll.

    https://www.scirra.com/manual/114/mouse

  • So in the picture which is the object to push and which is the explosion? Normally an explosion is round so the angle to push the object would be angle(explosion.x, explosion.y, obj.x, obj.y).

    It's possible to calculate the point of collision between a circle and a box but it's not really trivial. In your picture at least the angle from 1 to 2 is not much different than 1 to 3. I guess I'm not fully understanding the issue. Could you post a capx perhaps?

  • Probably use Mouse.X instead of Mouse.AbsoluteX and the same for Y.

  • I'm not sure what line you mean by the other one. Do you mean point 1 to point 3?

    It looks like you can get point 3 with (x2, y2+radius) if that helps.

  • It doesn't work due to picking.

    https://www.scirra.com/manual/75/how-events-work

    A loop can help to make it works like so:

    for "" from 1 to 4

    -- colision detector is overlapping fog at offset (32*loopindex, 0)

    ---- set fog booleans...

    -- [inverted] colision detector is overlapping fog at offset (32*loopindex, 0)

    ---- system: stop loop