1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Synchronizing a group of characters movement

Discussion in 'Programming' started by peteynunchucks, Mar 22, 2018.

Tags:
  1. peteynunchucks

    peteynunchucks Member

    Joined:
    Jul 9, 2017
    Posts:
    15
    Hello Gamemaker Community,

    I am making a twist on the classic pong game that involves each player playing as a group of monkeys on a tree trying to avoid falling debris and also playing a match of pong.

    What I have trouble with at the moment is getting the Individual monkeys to move as a group. The purpose of the monkeys is to move as a group to serve as the paddle for the player and when hit by a piece of debris one of the monkeys disappear.

    Any help that anyone could provide is appreciated.
     
  2. drowned

    drowned Member

    Joined:
    Mar 21, 2017
    Posts:
    351
    There are a lot of ways you could do it, but based on the description it seems as if you're saying each monkey is its own object right? But you want them to move simultaneously when you press a direction key? So let's say you press your <move right> key, how about something like:
    Code:
    with(objMonkey) x += _hSpeed;
     
    CMAllen likes this.
  3. CMAllen

    CMAllen Member

    Joined:
    Mar 2, 2017
    Posts:
    856
    This is the best solution, but make sure that you separate your control input from the monkeys. If this code exists in the step event for the monkeys, then they will ALL execute that code when the conditions are met, so it will get repeated for however many monkeys you have present in the room.
     
    drowned likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice