How do I create a player turn

  • 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.-

  • .capx or screenshot of events? To Better visualize what ur talking about

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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...

  • 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,

  • Okay, i would do it differently altogether, but this solves the problem:

  • 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!

  • You are welcome

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