How do I create a player turn

Get help using Construct 2

Post » Wed Jan 14, 2015 10:37 pm

Hi there Constructors, this is my first post on the forums and I'm already excited to be part of the community!

Right now I'm developing a football game and it's 2 players turn based, so far I've already created a Global variable called "turn", which I can rename "turn: 1" and "turn: 2", I see it more simple to assign the whole "routine" of the players on it's turn and then pass the torch to next turn.

The problem is that actually I have a signal that tells when the ball reach or is on 0 velocity then set to next turn. So the complex thing comes on the "own goal", because the ball is destroyed and then it creates a new one in the middle of the field, and just because the new one is already on 0 velocity it makes the turn change when it's suppose to stay still.

Is there any way to change the way how the ball spawns? otherwise if it wouldn't be by this spawn the turns would work properly, just right on the end of the turn, pass the torch.

Need some light here, any help is more than welcome!

Thanks in advance.-
B
4
S
1
Posts: 34
Reputation: 416

Post » Wed Jan 14, 2015 11:04 pm

.capx or screenshot of events? To Better visualize what ur talking about
B
8
S
2
G
1
Posts: 96
Reputation: 782

Post » Thu Jan 15, 2015 6:39 am

I think i got it: The problem is, the ball is standing still, when spawned (velocity=0). But also you seem to use that attribute to END the turns.

A: Just pick another one there, e. g. "on destroyed" or when overlapping your goal-net.

B: You can use a variable or any other solution, to detect that the ball has actually moved, then trigger only, when ball "has moved" and "velocity=0" both are true. So it won`t trigger, if the ball did not move at all like when spawning.

Hope that helped, if not, more details please...
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Jan 15, 2015 9:11 am

Hi guys, thanks for your prompt response!

Multiple, you are right, the problem here is that I assigned (velocity=0) as an attribute to tell the system it is the end of the turn. The ball already has an "on destroyed" attribute but this makes it spawn again in the middle with velocity=0.

I think option B sounds like the proper solution, but unfortunately I don't know so much the code to create "true" or "false" events, but here I attached a picture of my project, hope it helps to all of you to find a solution!

Thanks in advance,
You do not have the required permissions to view the files attached to this post.
Last edited by Indomitus on Thu Jan 15, 2015 4:42 pm, edited 1 time in total.
B
4
S
1
Posts: 34
Reputation: 416

Post » Thu Jan 15, 2015 2:11 pm

Okay, i would do it differently altogether, but this solves the problem:
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Jan 15, 2015 4:39 pm

It worked like a charm! I just added a "system Moved=0" for when the ball is destroyed and that's it, I have the turns working and showing the right flag for each one.

Thanks a lot Multiple, cheers!
B
4
S
1
Posts: 34
Reputation: 416

Post » Thu Jan 15, 2015 6:09 pm

You are welcome ;)
B
8
S
3
Posts: 197
Reputation: 1,207


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests