LukeWolf's Forum Posts

  • Please allow us to add thread labels or prefixes - for example in the How Do I forum, you could allow thread authors to add a prefix for their thread like "need help" or "solved", etc. This would be editable only by thread authors and moderators+.

    Tagged:

  • Thanks FromChris. I decided to do that anyway. I just thought there would have been a different way to do it. There doesn't appear to be any system condition that checks what layout the game is on. You have to track that with a variable then check it.

    Appreciate the help from both of you, thank you!

  • Thanks Plinkie. That made a lot more sense.

    I just have one more question then - How do I keep the variable updated then?

    For example my levels go like this - "Level_<number>" How can I just set the variable g_level which is a number variable to the number after the _ in the layout name?

    First of all I would need to check to see if the player is on a layout starting with "Level_" then if so, set it to the number after the underscore. I'm hoping to have a condition that checks this as an expression and then have an action that would set the variable to the number after _ - but I don't know how to do that.

  • What's an efficient way to change levels?

    In my game I plan to have 100 levels. So far I have designed 22 levels.

    Before the player goes to the next level, they will see a score screen for the level they just completed.

    I have hardcoded checking a global variable that stores the name of the level they were just on, and then going to the next layout.

    But when you plan to put in 100 levels, having 100 lines of code just specifying the layout to go to makes me feel yuck and I'm convinced there's an easier way to do this.

    I thought that perhaps I could change the levels to just numbers and then set an increment the numbers where needed but the problem is I cannot "go to layout (by name)" just by setting the value to my global variable number that keeps track of what level the player is on. It has to be a string.

    What's the best way to do this where I don't have to put 100 lines of "system g_Level = "Level_<levelnumber>" - System Go to Level_<levelnumber>?

    Tagged:

  • Ahh, I know what's causing the infinite loop. I created this:

    i.imgur.com/wAnekPp.png

    So when I disabled i_CurrentDirection = i_TargetDirection condition on Change_Chomp_Direction it exceeds the call stack.

    I've had a look at your example. Unfortunately my project is too complicated to restructure around that at this current point. I will look at major restructure options because I do believe I could clean a lot of this up, and I could use your help with that of course, but at the moment with the way I have designed my game, this is the only thing I need to do for enemy AI so I can finish all of my levels off.

    What I've done is re-enable the disabled condition and disabled the event that was causing the infinite loop (I'll probably end up deleting it). So now he is back to only getting stuck if the tile checker sprite chooses a direction where an obstacle already is. It seems like he is picking an unsuitable direction after it gets deleted from the array.

    I think it's best if I send you my project so you can see all of it properly so you can tell me what's going wrong here. I know I'm really close to getting this right, I just keep making the wrong turn with it so I don't think it will take too much of your time.

  • Sorry for being so vague with my events Stan.

    I am using the tilemovement behaviour. It is core to character movement in my game.

    However, I found what the problem is. It is this:

    i.imgur.com/XLWJXSU.png

    Because Chomp's current direction is not facing the target direction, they are not matching and because of that, this event does not run, hence he gets stuck.

    So What I did was disable this event to test it, but then this happens:

    i.imgur.com/RY0x0tL.png

    And then two things happen:

    Chomp spawns then does not grow or Construct crashes to the desktop with no error message.

    This is really irritating because I can't replicate this issue in a fresh project in order to make a bug report but this only happens when I disable that event condition. I don't really feel like posting my whole project and events in a public repository just for Ashley to see what's going on and fix it.

    I may have to look at a work around but I don't know how else to work around this issue at the moment. The most logical solution to fix it was to disable this event and it makes sense for it to keep working but I'm getting other problems happening. I may have to look at how this is impacting his spawning now. It's hard to ask to send this to you because I've already done that with my last problem I shared on the forum. :P

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop2000 but I think I am still doing something wrong here.

    It seems to be deleting the correct variable when it is not available but then picking it right after it gets deleted. Here's a screenshot of my events:

    This is where it deletes if it it's overlapping an obstacle then calls the function for the enemy to pick an available direction:

    i.imgur.com/vdzprmJ.png

    This is where it picks an available direction:

    i.imgur.com/fki1zHZ.png

    It deletes first then picks, I don't know why it's picking a deleted direction though.

  • I'm sorry for such a simple question, but I can't seem to find a straightforward answer to this.

    My AI enemies choose a target direction to face before moving.

    I have one tilechecker sprite that checks for obstacles before allowing my AI enemies to face and move in said direction.

    With that, I have an array where my enemies will keep track of all of their possible directions they can face.

    If the tilechecker covers an obstacle, they need to remember that they cannot go in that direction anymore so that target direction is deleted from the array before checking for another suitable direction until it finds a clear direction to start facing. This is to prevent enemies rotating to face a direction they cannot go in and look silly.

    I want my enemies to pick a random available direction that is in the array, but I am doing this a bit wrong I think.

    Whenever I set i_TargetDirection to random(enemy.IndexOf(enemy.i_TargetDirection))

    Instead of picking these values:

    i.imgur.com/F6OXtpg.png

    It picks these values:

    i.imgur.com/vig1hlI.png

    Or in the case of the above expression example it actually randomises the number like 0.5234523452345 and ignores the fact that I want to select from the enemy's instance variable.

    What's weird about this is I can choose to delete the value accurately with Self.IndexOf(Enemy.i_TargetDirection) on the array object. But how do I randomly pick a range of values stored in the array and not the element number? If I delete the element number, the element numbers re-count themselves and it changes, the values stored don't do this, and my enemy gets stuck going into an obstacle they can't move through because the wrong value was deleted from the array.

    Also for your information, the i_TargetDirection values mean the following:

    0 = idle (This is not seen in the array because it is not a value that is used to tell the character to face a direction)

    1 = right

    2 = Down

    3 = Left

    4 = Up

    Your assistance is greatly appreciated. Thanks!

  • 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!

  • 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?

  • No worries but I think what I'm talking about is a different issue, and I'm still having trouble reproducing it exactly. Just that a lot of the time when I have the debugger running on the side while I make changes then close it, it will soft crash construct all together. Even with worker mode switch on for the layouts, it's still happening.

  • 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.

  • Are you talking about when it crashes like it exits and it doesn't display an error message? I've been trying to reproduce those to report them but it's difficult to get an accurate test but this happens commonly if you close a debugger preview after you made some changes to the code while it is opened.

    And for anyone that doesn't know how to use worker mode just do this:

    1) Select your project folder

    2) Click on "view properties"

    3) You'll find it under the "ADVANCED" section >> "Use worker" tick box.

  • 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?