Question about using a single event sheet on different level

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi everyone,

    I'm quite new to Construct 2, I started learning it about 1 month ago and it's really an awesome tool !

    I started my first project and despite I read 100% of the manual, I still have some troubles for things that I thought would be simple. Here is my problem :

    In my game project I have a character on the left side and 4 enemies on the right side, dispatched as follows (consider -------- are spaces) :

    • -----------------------------E1-----------------------E3

    Character

    • -----------------------------E2-----------------------E4

    I want the character to attack Enemy 1 or 2 a random. If the target is dead he will attack the enemy on the second row (i.e. E3 if enemy 1 is dead or E4 if enemy 2 is dead). Nobody moves. Until here it's very easy. My problem is that I have a good tenth of different enemies that I would like to be able to place wherever I want across tenths of levels. Moreover, enemies have very different sizes and shapes, and often overlap each other, making it difficult to pick an enemy by specifying a single point on screen which it overlap. So I have 2 questions that I'm really scratching my head with :

    1) Should I use object instances when there is 2 (or more) times a single enemy on the screen? Up to now, my answer was "no", and I used 4 different object types because I felt it would be complicated to pick the correct object instance (and enemies also have random actions that they perform all together when using instances), while it's easy to copy-paste the events to make new object types. Or is it something that I'm missing?

    2) Most importantly, how can I specify which enemy the character should attack without rewriting its full event sheet for all levels (as there will be different enemies on each of them). For example, if I have two ninjas in the front row which I name ninja1 and ninja2, it's easy to tell the character to attack ninja1 or ninja2. If on the next level the two enemies on the front row are warrior1 and warrior2, how could I tell my character to attack one of these two guys without rewriting my character's event sheet for each level?

    Thanks a lot for your time and help !

    Pablo

  • 1) There's no right or wrong answer for that, it is actually depends on how do you want to achieve it. I guess it depend on which method you're more comfortable with, and easy for you to debug, at the same time it works.

    2) Right-click, include event sheet (this is what you're looking for). Put the mechanic in separated event sheet. While storing unique variables/event in the layout event sheet. OR, all your level layouts can be referenced to one event sheet, you can change that in properties.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the (very !) quick reply, DuckfaceNinja.

    1) Ok, I guess I'll continue with different object types. I thought I read somewhere that the game has to load each sprites for each different object types, even if the sprite used were the same. Is it true? If it is so, using object instances seems a better solution but I just can't find a way to make them do what I want and selecting the right one easily.

    2) I should have specified that I'm already using event sheet includes for my character (as well as enemies). The first solution you propose ("Put the mechanic in separated event sheet. While storing unique variables/event in the layout event sheet.") seems not useful in my case, as nearly every event refer to a specific enemy name, thus making it not worth using includes. I'm sorry but I don't really understand your second solution. Is it something to change in the project properties or the preferences? If so, I don't see where... Could you tell me more?

    I also tried to regroup my enemies into families, but it didn't really helped so far...

    Among solutions I tried to find, I thought about creating 4 global variables "E1", "E2", "E3" and "E4" and changing the value of the variables at the beginning of each level. For example : global variable E1 = "ninja1", E2="ninja2" for the first level and change the values to "warrior1" and "warrior2" in the second level, then replace the "ninja1" object by E1 in the character event sheet, hoping it would select different object types... But it don't seem to work... Maybe this is just not possible.

  • I'm sorry but I don't really understand your second solution. Is it something to change in the project properties or the preferences? If so, I don't see where... Could you tell me more?

    I tried to create a few game before, but abandoned all since I have learnt a lot from all my 7 previous project, which equipped me enough knowledge to start on my real dream game, CCG . So, I did something like that before which I have 10 level layout, and just one event sheet. Basically, I put everything in that single eventsheet (ES), so if an object is not present in current layout, their event won't run. If remember correctly, I used a lot of condition checking the current layout name, to switch off certain events and group.

    [attachment=0:3qxp0len][/attachment:3qxp0len]

    Among solutions I tried to find, I thought about creating 4 global variables "E1", "E2", "E3" and "E4" and changing the value of the variables at the beginning of each level. For example : global variable E1 = "ninja1", E2="ninja2" for the first level and change the values to "warrior1" and "warrior2" in the second level, then replace the "ninja1" object by E1 in the character event sheet, hoping it would select different object types... But it don't seem to work... Maybe this is just not possible.

    Similarly, this perfectly doable by checking current layout name, then set your variables accordingly.

    However, personally, I don't recommended using just one ES, as I learnt that it is troublesome to debug because it could be anywhere, one of my best practice now is to have awful lot of ES, narrowing down on game bugs are much easier and time saving.

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