[SOLVED] How do I revert from families? + Object Bank Discussion

1 favourites
  • 15 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I have 3 enemy characters that I originally thought putting them into families would be a good idea. Characters in my game use the tile movement behaviour to move around.

    They each have containers with 8 helper sprites in them which helps them do all different things with all the same behaviours and almost all the same instance variables and effects. Each of the helper sprites has a family of their own type.

    I realised that when I was programming the different enemy characters, I wasn't really using the families because they need to act independently from one another. so I wanted to take them out of the families.

    So I manually created the sprites for the enemy character and all of it's helper sprites, put all the instance variables, behaviours and effects in, used it as a template for the other 3 enemy characters. I made the appropriate adjustments so each enemy character with no family were the same with the sprites that are in the family, apart from the name.

    I highlighted and replaced all the events for the first two enemy characters and all of their helper sprites and they both work perfectly.

    The third one however, replaced all objects in the events without error but when the enemy spawns, it does not move. I don't know what else I am doing wrong. The only difference between the third enemy character and the first one is that I have an 9patch object that has nothing to do with moving the character in it's container.

    But if I was to use the debugger to move the character to a different place, it will behave as expected.

    Has anyone else experienced an issue like this? How did you fix it?

  • I have 3 enemy characters that I originally thought putting them into families would be a good idea. Characters in my game use the tile movement behaviour to move around.

    They each have containers with 8 helper sprites in them which helps them do all different things with all the same behaviours and almost all the same instance variables and effects. Each of the helper sprites has a family of their own type.

    I realised that when I was programming the different enemy characters, I wasn't really using the families because they need to act independently from one another. so I wanted to take them out of the families.

    So I manually created the sprites for the enemy character and all of it's helper sprites, put all the instance variables, behaviours and effects in, used it as a template for the other 3 enemy characters. I made the appropriate adjustments so each enemy character with no family were the same with the sprites that are in the family, apart from the name.

    I highlighted and replaced all the events for the first two enemy characters and all of their helper sprites and they both work perfectly.

    The third one however, replaced all objects in the events without error but when the enemy spawns, it does not move. I don't know what else I am doing wrong. The only difference between the third enemy character and the first one is that I have an 9patch object that has nothing to do with moving the character in it's container.

    But if I was to use the debugger to move the character to a different place, it will behave as expected.

    Has anyone else experienced an issue like this? How did you fix it?

    I do not know whether it will help you or not, but I had the same problem.

    In my case, I cut it by creating an enemy in advance (I use for this a separate layout where I place the first copies of the objects)

    I do not know why this stupor is connected with some objects (Enemies). But if there is not a single object on the ground, then they can stand still after you have thrown them out of the family or removed the first copy.

  • Hey WRS,

    Thanks for your response.

    Are you saying that you fixed this by placing all of the objects for my enemy characters and their helper sprites into a separate layout like an object bank?

    Everything works but one block of code that just doesn't seem to run at all for some reason.

    I wouldn't mind sending my project to someone like dop2000 or if Ashley could have a look at this for me because the only thing that has changed is I replaced all of the objects without getting any errors for instance variables, behaviours or effects being different and for some reason this will not work and the only difference is that it's not in a family anymore.

  • This is realllyyy strange.

    I'll share a screenshot of my events here:

    i.imgur.com/SA80AtZ.png

    This is the block of code that will not run even after all conditions are met.

    I am testing the enemy character to go up so event number 391 is what I'm testing.

    He will not move at all when all of those conditions are met.

    But if I replace it with something like this:

    i.imgur.com/cHkkvhU.png

    It runs fine.

    Before this I even tried deleting the events and manually re-creating them and it wouldn't work.

    My enemy character here is built off the same model and code as another enemy character and that one does not have this problem at all. I am able to use the tilemovement set grid position action with them but not with this character, and I really have no idea what's going on. The tilemovement is enabled in the debugger so that is not an issue. I'm really stuck why this would happen with the tilemovement behaviour on this one object in my game where other objects designed the same will work but this one won't. I have been very thorough in making sure everything is the same down to the last property with the exception that the enemy is spawning in a different position and that it has a 9-patch object in it's container (specific to the design of this particular type of character and that has nothing to do with any of the objects you see in the code). I don't know what could be happening differently but I am happy for you to have a look Ashley - it's a real mystery. I'm happy to send you the project files before family objects are replaced, replace them and watch what happens. I don't want to believe that it's a problem with the tile movement behaviour but this is a real mystery I would love to learn from providing you don't mind having a look please? I will share here what it was after of course.

  • I can take a look if you send me your project, my email is in this post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you saying that you fixed this by placing all of the objects for my enemy characters and their helper sprites into a separate layout like an object bank?

    Do I understand correctly that your enemy appears on the map and is simply not in place, inactive?

    And yes, I have a separate layout specifically for all objects where I set up their properties.

    If the problem is in the 9 patch, just delete it and see if it will work without it, then you will return it.

  • It's not just me, Dop has looked at my project and he also agrees, it's odd, but he's taught me about the browser plug in and logging stuff to a console and recommended that I should probably look at incorporating this type of movement into my ultimate move function that I have instead of having it separate. I will do that and see if it resolves the issue, but there is something I want to learn more about:

    > Are you saying that you fixed this by placing all of the objects for my enemy characters and their helper sprites into a separate layout like an object bank?

    >

    Do I understand correctly that your enemy appears on the map and is simply not in place, inactive?

    And yes, I have a separate layout specifically for all objects where I set up their properties.

    If the problem is in the 9 patch, just delete it and see if it will work without it, then you will return it.

    WRS Yes, my enemy is spawned by another object. It's spawned by their respected spawner objects I have manually placed inside the game.

    I'd like to know more about object banks though. There seems to be little documentation about them. I see them in the demo projects but I don't really understand them.

    What is an object bank?

    Why would you need one?

  • What is an object bank?

    Why would you need one?

    When you create a new character, (it will be the very first in the game, it will be a copy of number 1) you assign different behaviors to it and format their settings. For example, the speed of the character, its viewing angle, and so much worse.

    So here. Subsequent copies of this character will take the settings from the first copy of this character.

    Since you do not need this template on the real game mapping, you create another layout, it will not be displayed in your game. But when you are modeling levels, you simply copy all the elements from this layout and they already have the parameters you need.

  • So if I understand you correctly WRS, you are saying that if you place the object in a different layout and use it as an "Object Bank", set all of it's properties, the way it's facing, initial instance variable values, what behaviours are enabled and their values and effects, it will load them from that layout into the layout that the player sees and you don't have to set them right after it creates the object in an event action block (unless the value varies) and this works for spawn an object and create object actions?

    And are you saying I should try making an object bank for my enemy characters because it will fix this problem like it did for you?

    I did try what I said I would earlier. I moved the event block into my standard move function and interestingly enough, the actions for moving the enemy character is running but the tilemovement behaviour for simulate tilemovement pressing up is not working but it will log a string to the console for me and if I replace it with "Set position to Self.Y-1 like I did in my previous screenshot, it will move.

    This is very strange indeed. I am very curious as to what's happened here. I'm starting to become convinced there is an issue with the tilemovement behaviour. I'm not 100% but it's a mystery. The trouble I am having is reproducing this in a new project so I can report this to be fixed unless you are willing to have a look Ashley - I know you're busy, but I would love for you to check this out. If it is indeed a problem with the tilemovement behaviour or an issue that families cause in general when using the replace object feature, it could be a good optimise for Construct. I'm happy to send my project through to you so you can see what's happening with it.

  • That wasn't what I said :) I said that the bug in your code is not in event 384, but somewhere else.

    In fact, I am pretty sure it's in event 393 - the problem is with condition "CHAR_Sticky_TileCheck_Move not overlapping SPAWN_Sticky_Pipe_Point"

    And the reason it doesn't work is because "nofam" object has a different collision polygon, slightly bigger. It causes overlapping, event doesn't trigger, status doesn't change, nothing works.

  • Sorry Ash, it was me all along nevermind! *Feels bad!*

    You did it, dop2000! Thank you! The problem was I completely forgot about the collision polygon! - This was set extremely early in v0.1.0 of my game and I'm working on v0.6.0 now - something a few months later that I never personally documented. I appreciate you spending more time on this than expected.

    Further, I've now moved checking for "Exiting_Spawn" status to be under the "Move_Sticky" function for all directions instead of having move events in a different place and in a different way.

    I have optimised event 393 (now called event 384 as event 385 is deleted) so that it will just set his patrol status once he is out of his spawner. Also once he is size 32x32, I will just set i_Clam_Speed to 100 so that when "Move_Sticky" function is called he can actually move.

    With that all tested and working I can uniform this behaviour with the others, wait for Construct 3 to update now that Ash has fixed the family deletion crash issue and remove those annoying enemy families all together!

    I'm really glad to find this was actually my fault and not Construct's! This just proves that Construct is working as expected with the TileMovement behaviour!

    WRS I'm still keen on understanding more about the object bank if you can confirm my understanding of your previous post, that would be great.

  • So if I understand you correctly WRS, you are saying that if you place the object in a different layout and use it as an "Object Bank", set all of it's properties, the way it's facing, initial instance variable values, what behaviours are enabled and their values and effects, it will load them from that layout into the layout that the player sees and you don't have to set them right after it creates the object in an event action block (unless the value varies) and this works for spawn an object and create object actions?

    And are you saying I should try making an object bank for my enemy characters because it will fix this problem like it did for you?

    I did try what I said I would earlier. I moved the event block into my standard move function and interestingly enough, the actions for moving the enemy character is running but the tilemovement behaviour for simulate tilemovement pressing up is not working but it will log a string to the console for me and if I replace it with "Set position to Self.Y-1 like I did in my previous screenshot, it will move.

    This is very strange indeed. I am very curious as to what's happened here. I'm starting to become convinced there is an issue with the tilemovement behaviour. I'm not 100% but it's a mystery. The trouble I am having is reproducing this in a new project so I can report this to be fixed unless you are willing to have a look Ashley - I know you're busy, but I would love for you to check this out. If it is indeed a problem with the tilemovement behaviour or an issue that families cause in general when using the replace object feature, it could be a good optimise for Construct. I'm happy to send my project through to you so you can see what's happening with it.

    Yes that's right.

    The first moment of use.

    For example, you have a camera (this is one sprite), but it can be sent in 4 different directions. Top, bottom, left, right.

    If you create 4 copies of the camera and configure them initially in different directions, you can simply copy the camera you need from the layout, without customizing the behavior there.

    The second point of use.

    You create an enemy and set up all your behaviors.

    Then, at the very level, the enemy is created automatically by an action - to create an object. In this case, the system will take all configured parameters from the very first instance.

  • That's interesting!

    Thanks WRS!

    I just made this change in my game and it is definitely working, very neat too, it's not too hard to make either, you just place objects in the objectbank layer and Construct does the rest! No more having to remember to put all instances in and on the outside of each layout!

    My original understanding of Construct is that it only loads the objects on the layout. Maybe I made a mistake with this or this changed when r125 came out but after r125 are object banks still needed?

  • That's interesting!

    Thanks WRS!

    I just made this change in my game and it is definitely working, very neat too, it's not too hard to make either, you just place objects in the objectbank layer and Construct does the rest! No more having to remember to put all instances in and on the outside of each layout!

    My original understanding of Construct is that it only loads the objects on the layout. Maybe I made a mistake with this or this changed when r125 came out but after r125 are object banks still needed?

    I can not answer this question as I use the Construct from the r136 version))) How it worked before I do not know)

  • Don't worry, I've created an object bank and it's so useful and makes it real clean, I think I'll do it for all of my games!

    I also hope this thread helps other people have a better understanding around object banks too.

    WRS dop2000 I can't thank you guys enough for the help you've given me. I feel like it's possible to complete my game now. Thank you so much!

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