AllanR's Recent Forum Activity

  • brochiefist

    you could put all the different object types in a family, and then do what Estecka said with a For Each (Ordered) on the family

  • 3DPiper

    I did a tutorial about a touch swiping system a long time ago - I have been meaning to go back and see if I would do things differently now, because I have learned a lot in the last year.

    Take a look, it may help... (look at the swipe2 version): https://www.scirra.com/tutorials/726/swipe-to-change-page

  • Maydie

    Well, I couldn't resist... I made a quick stab at creating lakes. It is VERY random, and does not try to prevent overlapping, or to intelligently place them in any way.

    My son and I were working on random land generation last year, so this is a topic I am interested in. It gets fairly complex pretty quickly.

    What we wanted was to be able to generate land in a similar way to how Minecraft does it. To do that, you need to use Perlin Noise. There is a plugin for C2 that works great: https://www.scirra.com/forum/plugin-noisejs_t93998

    The nice thing about Noisejs is that once you find a setting that you like, you can use that seed number, and get the same results every time, or you can use a random seed, or let people share seeds they like with their friends. Plus you can create infinite layouts - when you have a seed, you just give it the coordinates and you can generate as much of the terrain around that point as you want.

    if you want to see our random terrain, look here: http://www.rieperts.com/games/Goblin/index.html

    Press ESC to regenerate the terrain. You can right-click on dirt to dig into the ground. Press F, G, or H to teleport to the left, middle or right of the map.

    Hold Shift down to run, and press SpaceBar for a huge jump.

    And here is the quick test I did at making lakes from the previous post (does not use the noise plugin): http://www.rieperts.com/games/forum/WaterMapLakes.capx

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

  • Try Construct 3

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

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

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

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies