• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Avoid duplicated events (SOLVED)

Status
Not open for further replies.
M

michael0815

Guest
Hello,
I like to know the best way to avoid duplication. Here is a simple example:
* game for 4 player
* each player has 1 headquarter

Here are some options but I hope there are better options I do not know until now:
1.one object for each player
(+) organization of a room is easy
(-) events have to be duplicated for each player object
Q: Does GM provide a option so objectA can inherit events from objectB?

2.one object for all player
(-) organization of a room is complicated
(+) no duplicated events
Q: I do not know how to define which object belongs to which player in a room. What I could imagine is a start script which will assign each player to one object of a room.

Greetings michael
 
F

float

Guest
You can set parents per object. But I assume that your objects are generic and can be used (i.e. a barracks objects that can be owned by any player and not a new barracks object per player) then you can use the object id used in the room editor as a unique id to be used to a specific controller object, or even just set a variable in the objects creation code (right click on the object on the room editor) to an arbitrary variable which tells which object controls it.
 
I mean this with no disrespect, but the questions you are asking are really base level GML object and variable stuff. Have you run through any tutorials from people like Shaun Spaulding (or others)? They won't necessarily address your specific game type, but the base coding ideas apply to all projects. I'd highly recommend doing some of these tutorials (as many as you can) so you can get a better understanding of how objects can be utilized. It should then become fairly apparent how to implement your specific system.
 
Status
Not open for further replies.
Top