R0J0hound's Recent Forum Activity

  • I couldn't open the capx because i don't have a third party plugin. Looking at the xml it looks like you set the variables in two different places.

    one place uses choose(0,1,2,3) another just random(0,3),

    the other uses random() in onplace and round(random()) in another.

    My guess is that's the issue, you're setting the value twice.

  • Here is an experiment to allow faster access to objects, arrays and instance variable without having to pick them.

    As a simple example say you have the uid of a sprite you want to get the x value of. You'd have to do:

    sprite: pick by uid 33

    sprite: x=200

    --- do something

    you could do

    system compare function: call("", 33, ".x") = 200

    --- do something

    Or maybe you have something more complex. like an array with uids of sprites, and each sprite has a hat object whose uid is stored in a hat variable. How do you compare the hat color of the sprite in array index 1 with the one in array index 5? and if they are different colors, make both 50 pixel tall?

    The solution probably involves a family or local variables to pick things one by one. It can be fairly complex and the readability of events is reduced.

    Anyways instead of doing that picking the normal way here's how you could do it with the utility function i came up with.

    System: compare function.call("", array.uid, "@", 1, ".hat", ".color") = function.call("", array.uid, "@", 5, ".hat", ".color")

    --- function.call("", array.uid, "@", 1, ".hat", ".height", "=", 50)

    --- function.call("", array.uid, "@", 5, ".hat", ".height", "=", 50)

    Or it even works well for something like arrays of arrays. Say you create it like this:

    global number rootArray=0

    start of layout

    --- set array size to (10,1,1)

    --- set rootArray to array.uid

    --- repeat 10 times

    ------ create array

    ------ function: call("", rootArray, "@", loopindex, "=", array.uid)

    It is a benefit to be able to avoid picking rules. Then you can access the 3rd element of the 2nd array with

    function: call("", rootArray, "@", 2, "@", 3)

    It's basically shorthand picking to get and set variables or values in an array.

    *Currently it doesn't work with text variables.

    *Error checking is minimal.

    * you need to add events to the function for every object type and property you want to support.

    here: the bare initial version.

    https://www.dropbox.com/s/igu4kum3t67nx ... .capx?dl=1

    Could be useful for complex data structures.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To me it looks like you'll need:

    * a way to move objects back and forth on a path.

    * use an array or something to have a list of the objects on the path in order. That way you only need to look at the objects next to each other to handle collisions.

    * be able to loop over the list either direction to be able to push chains of objects.

    * pushing objects can be done by either repeatedly moving the next object forward on the path until not overlapping, or a you can go 100% precise and use some math to find the exact point where the two objects intersect.

    * when shooting a new object and it hits an object on the path, it needs to be inserted into the list at that spot. Maybe with a nice gradual transition that moves the object onto the path.

    *it looks like you'll have to keep track of which objects are in contact with each other. Should be as simple as setting a Boolean when they first collide.

    * matches seem to be triggered when adding a new object to the chain or when a new contact is created. Should be simple as checking the area in the list around where the contact happened.

    It's not really scoped to make for a good tutorial.

  • With two tiledbackgrounds you can make it look like it's animated, or at least moving forward.

    https://www.dropbox.com/s/cm27xvzisnoxe ... .capx?dl=1

  • There is value in tweaking the auto-generated corner nodes, so I added an editor, and the ability to load a saved node layout.

    https://www.dropbox.com/s/ypi54gflkh6q9 ... .capx?dl=1

    After doing it i've realized some better ways to do it, but anyways here's how to use it now:

    There is a variable gen_mode in setup that changes if the nodes will be

    0 : auto-generated or

    1: loaded from a saved list

    To use the editor you have to un-comment the action to enable the editor group in event 2.

    When the editor is active you can drag nodes around. Right click to destroy/add new nodes. Finally middle click to put the node list into a editbox that you can copy and paste in events to load later. I made two layouts and the node loading is in events 18-19. Just clone the layout to make other layouts.

  • zenox98

    The issue is the point cleanup is overzealous. You can disable event 4 and it works.

  • zenox98

    You mean curves with the walls? It was only made with unrotated boxes in mind at the moment.

    Edit:

    Updated it to work with rotated boxes. The cleanup stage to reduce the points doesn't work as well though.

  • A convex hull may be what you want, however it's won't be like your second image exactly.

    Here's an example:

    https://www.dropbox.com/s/tcwhjf0expdwx ... .capx?dl=1

    Other methods here:

    https://en.wikipedia.org/wiki/Convex_hull_algorithms

    You may be able to get closer to your second image by first doing the convex hull and then collapse in some of the sides.

  • YoHoho

    The astar search function returns a list of the uid's of the nodes making up the path. I implemented moving before here:

    I think i came up with a cleaner way, so i updated the capx above in this topic, as well as added some more comments.

  • ...and as another behaviorless example there is this:

    https://www.dropbox.com/s/aondowy4ycjgl ... .capx?dl=1

    Click drag to mark start and end points.

    I took dop2000's map, added in the event based astar shortest path search i've made previously, added some setup events to generate nodes at the corners of the walls, and then finally did an event based los to create a connection graph.

    It works pretty well, I thought it would be slow. There are a few things that could be done to improve it.

    * The corners can be moved closer in. Too close may cause issues with the los and generation though.

    * Only unrotated boxes work for walls with this. Rotated boxes or arbitrary polygon shapes can be done. The generation and cleanup of the nodes in setup would need to be modified.

    * The mesh is kind of ugly, so another idea is to build in an editor in the game to be able to give more manual control if need be. Tweaking the whole thing to be more navmesh like would be nice.

    Anyways, that was fun.

    cheers

  • I've had luck in the past doing instant path finding in the past by utilizing the LOS behavior.

    It's similar to oosyrag's idea but works with simpler maps of just isolated boxes.

    It works by first placing corner objects at the corners. Then the objects either move to the goal if it has LOS, or it goes to a corner sprite it has LOS to. I also believe it did some checking to see which corner was closer to the goal, but it's been a while since i looked at it.

    My following code is in need of improvement since objects get stuck, and you could manually place corner objects instead of automatically moving it if need be.

    I'll probably putter around and see if i can come up with something closer to your op. It seems interesting.

  • This comes up a lot. You can’t do some thing like

    Key = 40 | 41

    You have to do

    Key=40 | key=41

    The reason is because or is treated like an operator like +. The two numbers get or’d together which isn’t what you wanted in your op.