got problem with movement

Get help using Construct 2

Post » Wed Aug 21, 2013 1:53 pm

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...
http://paf.im/L4hmK
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 1:59 pm

i wonder if i understand the way pathfinding and groups are working....
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 2:01 pm

just realized that i put stop animation instead of stop pathfinding, but that didn't help ...
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 2:11 pm

hum... they both move only on turn 1 ....
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 2:44 pm

try with trigger once...

here's the updated file
http://paf.im/AD1kn

B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 3:21 pm

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?

http://paf.im/14uDw
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 4:16 pm

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?
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 5:51 pm

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
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 5:55 pm

found it !!!!

every tick
sprite move<0 : sprite path stop
B
4
S
1
Posts: 20
Reputation: 290

Post » Wed Aug 21, 2013 6:00 pm

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!
B
123
S
43
G
41
Posts: 846
Reputation: 28,204

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, nahima and 6 guests