how do i switch solid states and control pathfind

  • ok, when a solid object is there,

    a sprite will automatically avoid the solid object as obstacle.

    but i dun get it why when i make the solid object non-solid,

    the sprite stills automatically avoid the solid object as obstacle.

    making games is hard, sigh...

  • You have to regenerate the obstacle map...

    https://www.scirra.com/manual/154/pathfinding

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks a lot!

    i have finally been able to switch solid states of objects while

    the sprites are able to switch pathfinding through objects accordingly.

    i have make the working example, but there seems to be a bug,

    the first time i click okay button to change solid states of objects,

    the sprites doesn't reacts to it.

    subsequent switching of solid states of objects does

    successfully cause the sprites to react.

  • You're regenerating the obstacle map before you change the solid state. So it takes it till the second time to register. However, it seems like doing this too fast makes both button click events happen at once. So what I did was added another short wait and ordered those actions like this:

    wait 0.1

    set solid enabled/disabled

    regenerate obstacle map

    (guess you need another wait here to let regeneration finish)

    then find path

    Let me know if that works for ya.

  • Sorry to bring up this somewhat old post ....

    To check if my gfx card causes severe flickering, I've opened the above capx file and experienced that same as I see on my system.

    So now it looks as if my gfx card driver (which is hard to update because I bought a cheap ACER computer to just compile W8 apps) prevents me from working.

    If someone can confirm this, I'd be grateful.

    Here is what happens when I load the above pathfinder.capx

    It loads fine in C2 but as soon as I test the app (preview) the flickering begins.

    I am sure it is my system

  • spacedoubt

    you are awesome!

    it works, i have placed the order of events wrongly.

    wait 0.1

    set solid enabled/disabled

    regenerate obstacle map

    *( i never place any wait here. )

    then find path

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)