AllanR's Forum Posts

  • since your loop is "For each Node" and you want to pin that to another Node, you will need to first create a family (called NodeFamily) and put Node in it.

    Then you can have a "Node" and a "NodeFamily" selected at the same time and pin one to the other.

    so, you will end up with something like this:

    For each node instance {
        if (loopindex == 0)
       {
           old_uid = node.uid
       }
       if (loopindex > 0)
       {
            pick_instance_of_NodeFamily by old_uid
           {
              pin node to NodeFamily
              old_uid = node.uid
           }
       }
    }[/code:2g6gtpu2]
    
    I usually create instance variables (called NextNode and PreviousNode) and then save the old_uid in Node.PreviousNode and save node.uid in NodeFamily.NextNode
    That way you can randomly pick any node and know who it is pinned to, and who is pinned to it - and follow the chain if necessary.
    
    EDIT:  OH!! ROJOhound beat me again!  I need to learn to type faster!
  • Maydie

    You are using your WaterMap array more like a database of locations (hence the possibility of duplicates) rather than a map to what is in your layout (or what will be).

    I would structure it so that each cell in the map array represents (or "maps") to a tile on the layout. That way the array is two dimensional - just like the screen. If you know an x and y location for a tile, then you know its location in the array. That spot in the array can only hold one value - the type of tile at that location (water, or grass, or whatever).

    I whipped up a sample that picks 50 random locations for water. As it picks locations, it first checks to see if that location already contains water. If it does, then it chooses another location. Otherwise it sets that location as water so it can't get picked again. (My sample also creates the water tile so we can see it on the screen. I know you want to create the map first, and then the actual layout later).

    I added some mouse events at the end so you can click on tiles, and it will tell you what the map thinks is stored at that location. Or if you right-click anywhere, then it lists all locations containing water.

    capx: http://www.rieperts.com/games/forum/WaterMap.capx

  • Unconnected

    Going from 64x64 to 32x32 is not going to make much of a difference unless you have 1000's of objects. And you might want to keep the extra detail if you want to do a version for higher res screens.

    You can re-size images inside the C2 image editor. Click on the resize icon at the top (between crop and zoom in). Resizing can be applied to all animation frames at the same time. You may have to reset image points/ origin as well...

    (changing the size by adjusting its properties will not make any difference - as you suspected, but resizing it in the image editor will).

  • facecrime

    You can manually do the math the way your picture shows, or you can let C2 do the work for you.

    I whipped up a sample - where I pin circular sprites to the player and enemy and then test for overlapping (these can be set to invisible, but I left them showing so you can see what is happening). Player has 8-direction behavior so you can move him around. Enemy has bullet behavior and always moves towards Player.

    It doesn't do any obstacle avoidance - because I have no idea what your layout looks like, but this might give you some ideas to try out.

    capx: http://www.rieperts.com/games/forum/RotatingEnemy.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nikolatesla20

    another way to do what you want with the If/Then is to insert a blank sub-event after the If condition block of code:

    to add the blank condition, right-click on the "On start of layout" event and choose Add, then Add blank sub-event. (you can also just press B on the keyboard). Then all actions added there are still part of the parent event, but run after the If event above it

  • Hey, thanks for finding that example!

    That is awesome - the Screen Effect is the magic that makes it work.

    I was trying all kinds of complicated combinations of layers with different effects without much luck, but that example keeps things really simple. That will be very useful in the future!

  • nlacroixcforp

    I would use ROJOhounds Canvas plugin, you can draw paths and flood fill...

    https://www.scirra.com/forum/plugin-canvas_t64239?&hilit=canvas

  • Lalitinnovations

    where you create white bubbles, add a System Event "compare two values" saying:

    (first value) WhiteBubble.Count (comparison) > Greater Than (second value) 0

    Then the following code where you have create object WhiteBubble will only execute if there are still other instances of WhiteBubble.

  • megatronx

    I am not aware of any limit in how many instances can be picked in a single condition.

    The "For Each Object A" will only loop through the instances that were triggered in the parent event. If you wanted to process all instances you would need to add a "Pick All Object A" line before the loop to clear the filter applied by the trigger event.

    There should be no problem also picking instances of Object B. The only time I have had trouble is if you just created new instances. Those can't be picked outside of the scope where there were created until the next top level event.

  • Unconnected

    12 % 64 = 12

    because 12 goes into 64 zero times with 12 left over.

    so, you would have 12>=0 Then (12 - 12) else (12 - 12) - 64

    which is 0 or -64

    0 is the answer.

  • Unconnected

    The % symbol stands for MOD or modulo, which gives a remainder after dividing, so 197 % 64 = 5

    because 64 divides into 197 three times with 5 left over.

    TileXValue >= 0 ? (TileXValue - TileXValue%64) : (TileXValue - TileXValue%64) -64

    this is an if then else statement. The ? is the THEN and the : is the ELSE

    For what you are trying to do , I would use: Round(number/multiple) * multiple

    anything .5 or above will round up, and anything .499999... or down will round down.

    (oh! ROJOhound beat me to it again!)

  • Animatect

    I didn't look at my code very closely, I just know that I have learned a lot over the last year. The zooming in and out doesn't feel as smooth as I remember, so I think something there could be improved. Also, the invert check box doesn't actually do anything, and I seem to remember making that change which direction the screen scrolls, but I couldn't find any other version of the capx...

    anyway, good luck with your game!

  • Animatect

    Here is a scroll-able, zoom-able map example I did last year for someone asking similar questions. I might do some things different now, but this should give you lots of ideas to work with.

    you can use layout zoom if you want - just disable zooming for the UI layer by setting its Scale rate to zero.

    Tile maps are a very good idea for big maps - if you can build the map from a reusable tile set.

    capx: http://www.rieperts.com/games/forum/Starcraft_map.capx

  • beardman

    here is the version that I modified... http://www.rieperts.com/games/forum/Uru.capx

  • igalencar

    sounds like an audio scheduling type of problem. Which is something that was added in release r225. I haven't played around with it at all, but you may have to read up on that, and try the example to see if that will solve your problem.