0 Favourites

got problem with movement

  • hello,

    i'm trying to make a simple turn base with movement restriction.

    When i hit return, it change from player to monster and so on...

    i use groups to activated and deactivated the side i want to move

    i want to make a movement restriction to the player, so when it move x movement it stop....

    i use a instance variable, and on pathfinding movement it substract 10 from the instance....when it get to 0, it's stop...

    problem:

    the instance is going down on the monster turn

    the player dont stop

    here's a link to the capx...

    paf.im/L4hmK

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • i wonder if i understand the way pathfinding and groups are working.... <img src="smileys/smiley29.gif" border="0" align="middle" />

  • just realized that i put stop animation instead of stop pathfinding, but that didn't help ...

  • hum... they both move only on turn 1 ....

  • try with trigger once...

    here's the updated file

    paf.im/AD1kn

  • ok.... just found the Function ...

    try with it, they move once each on they turn, but i need to press the return twice to make it happen?

    paf.im/14uDw

  • if you have difficulty to look at my capx, here's the text:

    Global number turn = 0

    System every tick : settext to "turn"&turn

    keybord- on key return pressed

       - system turn = 0: function call "monster" ()

       - system else : function call "player"()

    function On"monster" : sprite5 regenerate obstacle map

                          sprite5 find path to mouse.x,mouse.y

                          sprite5 move along path

                          system set turn to 1

    function On"player" : sprite1 regenerate obstacle map

                          sprite1 find path to mouse.x,mouse.y

                          sprite1 move along path

                          system set turn to 0

    so when i start turn=0,

    i push enter text change to turn1 ( nothing else),

    i push again and text change to turn0 ( nothing else),

    then i push again text change to turn1 and sprite5 move to path

    push again text change to turn0 and sprite1 move to path

    push again text change to turn1 ( nothing else),

    i push again and text change to turn0 ( nothing else),

    then i push again text change to turn1 and sprite5 move to path

    push again text change to turn0 and sprite1 move to path

    and so on....

    why it need 2 turn to move?

  • FINALLY, found that i forgot the "on path found" ... DOH !!!

    now the movecounter is going down.... just need to found how to make it immediatly stop when it reach 0

  • found it !!!!

    every tick

    sprite move<0 : sprite path stop

  • Did you get to fix everything?

    Best thing about threads like these is that if someone ever stumps in a similar problem they can just read what you did. Thanks for sharing!

  • yes i did... i'm not certain it's the best way, but it work...

    cause right now, it use the pixel, so 1 pixel= 1 move... i have to look for dt that i saw somewhere....

    thank's!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
233 22,269
TiAm's avatar
TiAm
Unread hot topic
0 Favourites
Path Movement Behavior
98 52,480
R0J0hound's avatar
R0J0hound
Unread hot topic
98 7,599
norum82's avatar
norum82