99Instances2Go's Recent Forum Activity

  • Set a few invisible objects. Move from object to object with the the behaviour i allready pointed to:

    Look at the demo and the capx provided.

  • The easy way is to use (the default) solids. Doors & walls must be solid. Regenerate the map. Do this under 1 'trigger once while true.

    Use 'Regenerate region around object (the door) when its frame changed (close AND open). And ofcourse, after you changed its 'solid state'. It will reconize the changed 'solid state' and adjust the obastacles arround the door.

    Be aware that the obstacle map is ready the next tick (NOT this tick). So, the 'find path' you can do at the start of the event sheet.

    The 'on path found' you can set wherever you want. But, i dont see it in the pict. So i have no idea how often you force it to find a new path. Cant be done to often, because then all it does is search, and before a path is found, it will be searching again.

    The way you do it, all obstacles all over again, it can take quite some time to generate the obstacle map. And you probaly found a path before the obstacle map is ready.

    Also, there is ONLY ONE obstacle map. So setting new obstacles for one pathfinding object will change the obstacle map for all. So, dont use a 'for each' to set obstacles for all pathfinding objects.

    So what do you do wrong? I can guess, but i have no idea. I dont see the layout. Is the door to small compared to cellsize and cellborder? Did you forced it to look for a path before the obstacle map was ready ? Do you force it to find a path to often ? Are the collision polygones weird ? But i suppose, with those tips you can solve it.

    If you want to be sure, start a timer on the moment you regenerate the obstacle map (like 0.2 secondes). And when the timers goes off, let it find a path.

    Hope this 'rambling in the dark' helps you some.

  • Not only that, if it starts the animation to play from the beginning every tick, then all you see is the first frame.

    But, i can not state that based on a screenshot of 2 % of the event sheet.

    There are 2 options.

    The conditions is a trigger. The animations will play fine. Example:

    On Jump.

    Play animation "x-file" from beginning.

    The conditions are no trigger, then the condition can be true for many tricks in a row. Should use a 'trigger once while true'. Example:

    Compare two values > velocityX > 0

    Trigger once while true

    Play animation "x-file" from beginning.

    This means that one needs events to do stuff thats needs to evaluate and run actions every tick.

    And seperatly events that trigger animations. (can be subs).

  • And with those exceptions in place ?

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

  • Each way is fine. By now you have seen that for each problem there are 50 solutions in C2.

    Like using that simple 'On start of Layout'. I used to use that heavely. Now i rather use 'once while triggered'. In most circumstances, they do the same. But for me, the last one reads nicer, it wraps my head arround it in a better way.

    That is usaly the factor that makes you choose for one or the other way the most. How it wraps your head arround it.

    There is only 1 thing that you should avoid, (well a few more, but ... ) do not use collission/overlap conditions in big (nested) loops for many objects EACH TICK. That will bring the performans down.

  • That gives me a solid direction. TyvM.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Concept behind mine is ...

    I used 4 helper objects, to check for overlaps. The reason why i use helper objects is that checking overlaps with the same instances of an object is a bit tricky. Should use families. oosyrag did not use a family, so i was like, wth, i not gooing to do it too.

    Those helper objects (hor1 hor2 ver1 & ver2) have there origins set in a way that they overlap the questioned object and the object on the left, the right, on top and under. When i was dooing this, i found out that i dont need the 'under' for defining a rule, but i left it in there.

    Now, when you place an object over other objects. And when you pick all objects that overlap that placed object, the expression object.PickedCount gives you the amount of objects that are overlapped. Including the questioned object.

    So, in short, when i place the 4 helpers objects (in the for each loop) on the questioned object, i can according to how many objects this helper overlaps, make rules. And for this concept, there are only 2 rules needed, as you can see in the capx.

    oosyrag does kinda the same, he is using the cornerobjects to dedect overlaps. So he's also not checking overlaps between instances of the same object, wich is as i said very tricky.

    I was a bit suprised by his solution, but i did not understand his rules.

    So i had to find them out, stronger then myself. But i am old school. So i need to see what i am dooing. And helper objects i can see. Now, at this moment, i know the rules, i could translate the idea to an array, or translate it to a loop in a tilemap, if i wanted to. But in the end, what i have given to you is for me the first step in solving things .. see what i do. I often use the tick-top-down-loop first, before making the real loop. Because that way i see, tick by tick, what i do. How it works, or actualy dont work at all. If it works, i bring it in the real loop.

  • Bring the solids in 1 family ?

  • AllanR You seem very comfartable with regex expressions. Point me to a place to learn them ?

  • Sometimes it helps when you make those events in a differend order.

    Say .. have ....

    if x = 1

    set x to 2

    if x = 2

    set x to 3

    if x = 3

    set x to 4

    The first event makes the second true. As a result they will run all. A chain of elses is the best option, but it can also very easy.

    if x = 3

    set x to 4

    if x = 2

    set x to 3

    if x = 1

    set x to 2

    Now they do not make each other true, when executed top down.

  • Yes that is possible.

    The Pathfinding behavior has the Expressions

    NodeXAt

    NodeYAt

    Return the position of a node in the path that was found, in layout co-ordinates, using the zero-based index of the node. This is only available after On path found.

    And

    NodeCount

    The number of nodes in the path that was found. This is only updated after On path found.

    So, with NodeCount you know how many waypoints are in a path. If you want the coordinateds from point 2.

    That is NodeXAt(2) & NodeYAt(2)

    Now, to move to them is another story.

    I would use .

    Why? because (i did not try this one, but all rexrainbow 's plugins have the same great features) it has a condtion 'On arrived'. Wich is pretty easy and lovable.

    So, your objects need a instance variable that knows wich node they are supposed to go to.

    Add 1to that variable when it arrives. NodeCount tells you wich is the last one.

    Send it moving to NodeXAt(instance variable) & NodeYAt(instance variable)

  • You have this 'away' timer in place. It tells you how long the game has been offline.

    It actual tells you also how long the game is running.

    Just set a variable to round(TimeAwayL.ElapsedTime("away")), but this time only once and when it is zero (first start). The difference between the actual round(TimeAwayL.ElapsedTime("away")) and that variable = the online time.

    Now the total time is just = TotalTime + that variabele (online time). TotalTime = zero for first run. The offline time (you have that one allready in place), we handle once on getting from the local storage.

    You have to store total time in the local storage.

    24 hours is 86400 seconds. (if i count right) So, its the same thing as you do allready with your build time.

    So on TotalTime getting from the local storage.

    TotalTime = TotalTime + away time (away time has to been get allready)

    round(TotalTime /86400) gives you the amount of times this total time passed 24h.

    If its bigger then 1 do the random thing

    set TotalTime to (TotalTime) - (round((TotalTime /86400) * 86400), this sets the total time to the remaining second left to complete again a 24 hours cycle.

    Say your total time is 216000... round(216000/86400) gives you 2 (2.5 rounded) ... means there are 2 times 24 h passed. Now there is still .5 times 24 hours left, and have to start from there for the new cycle. (TotalTime) - (round((TotalTime /86400) * 86400) gives you what is left.

    Now the total time is just = TotalTime + that variabele (online time) again.

    You do the same with buildtime, where you have to use ceil instead of round, because it is zero based.

99Instances2Go's avatar

99Instances2Go

Member since 12 Feb, 2016

Twitter
99Instances2Go has 2 followers

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies