Synchronizing a group of characters movement

P

peteynunchucks

Guest
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.
 
D

drowned

Guest
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

Member
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;
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.
 
Top