LukeWolf's Forum Posts

  • korbaach, I didn't expect anyone to provide a full Capx of an example and share it with me and the rest of anyone else that might need help with issues like this.

    This is precisely the help I needed. I have applied similar principles to my game and it works like a charm. Thank you so much for going above and beyond, dude!

  • Hey LittleStain and Kyatric,

    Thanks so much for your feedback. It's helped me think so much more.

    Kyatric, I understand that it will be a lot easier if I was to post my Capx. Unfortunately, I don't feel comfortable sharing my whole game out just yet. It's also very complicated to separate the code. That is why I offered a skype interaction. I'm keen on screensharing on there with you. For now, I will continue to post screenshots attempting to implement the feedback that you are providing. I am sorry this is not the easiest way.

    So the code I showed you in the screenshot allowed the police to stop at the correct "GetIntoCar" object. However, they were not heading towards the police car to be deleted, they were just stopping upon overlapping the GetIntoCar object.

    So to help me further with this issue, and due to the feedback you guys have given me, I have removed line 69 which was making all police officers regardless of whether or not they are searching to "ReturnToPoliceCar", that was a bit of a dumb one on my end, so I appreciate you pointing that out. Also, I have determined that I will need to pick the instances. However, before I get into understanding this, I want to show you the code that works when there is only one police car. This is me taking a step back on this thing:

    http://prntscr.com/969531

    I believe from here, I just need to pick the right instances, but I am having trouble doing this without stuffing it up. Remember, there are 2 police officers per police car. They both have to go back to the right deletepoint from travelling along the path from the right GetIntoCar object.

    So from here they are: Stopping at any GetIntoCar object they run into, finding a path to any delete point, moving to that delete point then deleting.

    I'm so close to getting this right from here. I just don't know how to pick the instances in a way that it will work with multiple cars. =[ Further assistance on this issue is much appreciated and thanks so much for your help to this point.

  • So I've been trying to work this out over a matter of days now, and I'm really desperate for some help.

    To give you a scenario. The player can call multiple 'police cars.'

    For this, I create the police car and add 1 to the global variable for Police Calls

    I then get construct 2 to associate the Global Variable for Police Calls specifically to the police car's instance variable called Call_ID.

    When the Police Car reaches it's destination, it parks, then construct 2 will spawn 2 police officers and will set the police officer's instance variable Call_ID to the same one the police car has, so the police officers from that police car have the same Call_ID instance variables.

    After they search around the place for a time, they will head back to their police car.

    So once the total search timer is 0, the boolean 'ReturningToPoliceCar' is set to true.

    This is where it gets really complicated.

    There is a sprite object that determines when the police officer goes back to the car called PoliceOfficer_GetIntoPoliceCar. This object has the same Call_ID instance variable as the police officers. It will only tell the police officer to go back to the police car if the police officers' boolean "ReturningToPoliceCar" is true and they are overlapping the object that tells them to get into the car.

    The police officer needs to go back to the police car they came out of.

    I can do this if there is only one police car and the 2 police officers from that car, but when it comes to more than one police car present, it stuffs up. Police go to the wrong car!

    Here is what I have:

    http://prntscr.com/941p6p

    http://prntscr.com/941p92

    I know it's a complete mess. I think I'm going wrong at lines 72, 76 and somewhere between 77-80.

    I've become really lost with this. I've deleted the whole code and started again and I still can't seem to get it right.

    I can get it right if there is 1 police car with the 2 officers for the one police car but once there is 2 police cars with a different pair of police officers, it becomes complicated.

    I need to somehow tell construct 2 which police car is for what police officers so when they overlap or collide with the PoliceOfficer_GetIntoCar object, they go to the right police car and get deleted, but I'm so lost in how I can tell construct 2 that when it doesn't know which police car or what police officers are for what car to begin with. =[ The game has the capacity to provide an unlimited amount of police cars if really necessary, I have to keep it open for that flexibility. If any of this doesn't make sense please add my skype at lukenecklace so I can further explain/show and then once resolved I can share it here. Please help and thanks so much in advance.

  • Hey there,

    I'd like to make a suggestion for Scirra to please work in image points for 9-patch images with construct 2. I know this can be very useful.

    I'm trying to design a UI that reshapes and resizes itself, and it's very difficult to associate any images to the 9-patch. For now, I will work out other ways, but if scirra could perhaps work on a way to add image points to a 9-patch, it would be really handy! =]

    Thank you for providing such a great product and community, Scirra! I am thoroughly enjoying it!

    Regards,

    Luke

    Edit on 25th of October, 2015: After spending a lot of time attempting to work this out, I am going to recommend against this. I worked out a way to get a sprite to be set to the same size as the 9patch image using instance variables. However, if objects are already on the 9 patch sprite when it changes size, it will disorientate those objects. If you are going to use 9-patch for UI windows that will change given certain variables, it's a good idea to carefully size the sprite to the maximum size of the UI window, set it to invisible so it cannot be seen, then you can adjust the 9patch image as much as you like without distorting any currently existing visible objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So using LittleStain's advice, I have done the following:

    System: Every Tick

    set text to array.at(global variable)

    Next on clicked:

    Add 1 to Global Variable.

    I have also applied the same principle for the previous button (subtract 1 to Global Variable instead of adding to).

    It worked! Omg! I've been trying to work this out for days, I knew every time I thought about using global variables in conjunction with my array was the answer, but I couldn't get my head around it. Thank you so much, LittleStain! You're a legend!

    As promised, I have put your name in my coding to remind me to provide special thanks to you for your assistance. =]

  • Hey guys,

    Can I please get some help? I've been working on this problem for 3 flat days, I've tried searching everywhere on the internet to try and find something that can help me do the same thing I am after and I can't seem to find it.

    Here is what I have:

    http://prntscr.com/7u31yk

    Just to explain what's going on here: I have a 1D array. It is listing a fire or a money bag that appears in the game. The fire and money bag appear at random. The elements in the array are being pushed back on the X axis whenever a money bag or a fire is created, so in the screenshot you see here, number 6, which says "Fire" was the last thing that was spawned in the game. The game will continue to increase the size of the X axis for each thing that is spawned in the game for example, the next thing that appears will be at 7, then the next at 8 etc.

    In the game, I want to be able to display this a very specific way, and this is how:

    http://prntscr.com/7u31vh

    Where X will display whatever the text at it's co-ordinate is.

    The idea is getting those next and previous buttons to function. If I press next, and I'm at X1, it should go to X2, then if I press it again, it will go to X3, and so on down the X axis. I only want it to display the one X, not more than one.

    And I've tried to do this by doing the following code:

    http://prntscr.com/7u34ll

    So here is my problem:

    This code allows me to go to X2 from X1 (which displays the word Fire), but it will not go further than that. I know I could just copy the code from +1 to +2 and so on and so forth, but that will mean that the player will only be able to view a limited amount of X, I don't think that's the answer, and I don't want to do it like that because the game is designed to extend the X axis indefinitely.

    I've tried countless possibilities with this, and I'm having trouble getting it right. I can't remember everything I have done, however, this is the closest I am able to get it at the moment.

    If anyone can help get my Next button to work, I would really appreciate that. I can then apply an opposite formula for the previous button and that would resolve my problem.

    Your help is much appreciated, and I mean really appreciated. If you like, I'll be sure to provide a 'Thanks to [Your Forum name]' message somewhere in my game if you help get it right for me.

    Thanks bunch! =]

    Regards,

    Luke