LukeWolf's Forum Posts

  • Oh wow, it was that simple. It just goes to show how much I'm over complicating things with my project. I definitely need to work on that!

    Thanks for your help again, Dop. You're amazing!

  • Thanks again

    I'll definitely look into the Timer and how I can use it to make my game better.

    Just one thing though. Since I implemented the formula you suggested, the growing rate is working perfectly with the construction_Timer now, but I'm struggling setting the position of the building so it only looks like it's growing from the ground not growing out from the middle if that makes sense.

  • Thank you for your response dop2000

    Yes my Construction_Timer variable is an instance variable for the Construction_Site object which is only going to be used during a construction and is set to instances of that object.

    Basically when a building is being constructed, I flatten the height of the building to 0 and then every 0.1 seconds, I want the building to increase in size by 1% of the total height of the building until it reaches its total max height (so it looks like it's growing from the ground). But this needs to happen over a specified construction time, so if I make the construction timer 10 seconds, then it will be 1% of the buildings total height every 0.1 seconds but if the building's total construction timer is 30 seconds, then obviously the 1% will change over that period of time, because some buildings are expected to take longer than others to build depending on the type of building I have for my game, then I need the right formula to get this right.

    Let me provide a more specific example of what I'm experiencing:

    Let's put the construction timer at a total of 10 seconds, so it will take 10 seconds for my building to complete. The total height of the building is 128 pixels. The construction_timer variable reduces every 0.1 seconds, so we have to consider changing the height of the building every 0.1 seconds.

    My old code was this.

    The building grows and finishes exactly as the construction_timer finishes.

    However, if I do this (where I want to reduce hard-coding and magic numbers):

    The building finishes growing at the construction_timer value of 3.7, so the building finishes growing 3.7 seconds earlier than it should.

    I will try your suggestion of using the timer behaviour but please tell me what's wrong with my formula in those event blocks, because I will be using the same sort of idea with the timer behaviour.

    Edit: I tried using the timer but it does not allow me to perform actions every 0.1 seconds. I do not believe I can achieve what I want to achieve with this behaviour, so I will need to do it the way I have been, but I need to work out what I am doing wrong here.

  • Hey guys,

    In my game, my people will be constructing buildings using a 'growing' method where the width stays at the maximum possible value but the height will start at 0 but will gradually increase in height every 0.1 seconds. For this example, the total height of the building is 128 and the construction timer is currently set to 30 seconds.

    What I'm trying to achieve is no hard code, basically; If I adjust the height or the construction_timer values simply for different kinds of buildings, then I want construct 2 to adjust to the new values automatically. Unfortunately my attempt here demonstrates that the building gets completed 9 seconds early (or if the construction time is 10 seconds, its out by 3.7 seconds early) (you will need to copy the image address to get the full image because this post is cutting important information out):

    Please tell me what I'm doing wrong.

    Thanks in advance for your wonderful help!

  • Thanks again, Plinkie! Sorry about the confusion between my edits!

    Yes, I do. It's just not explained in these screenshots very well. You will notice that on the first block of the Construction Complete group that I set Person's Status value to 0. This checks:

    Conditions:

    Person Status = 0 (defined as wander status)

    Person Wander_Path_Cooldown = 0 (another cooldown system where a person will pause for up to couple of seconds when they reach their destination before moving to the next random coordinate),

    Person Not Pathfinding calculating path

    Person Not Pathfinding moving along path

    Actions:

    Person find path to (random(LayoutWidth), random(LayoutHeight)).

    Simple action for this status for the current stage of development.

  • I got it!

    I couldn't just check to see if anyone was overlapping the building or not straight away, I had to create some more variables:

    1) I created a boolean called "Built" - When the person finishes constructing the building, this boolean will be set to true.

    2) I created a variable called Cooldown_Construction_Brand_New with the initial value set to 3 - every second if the value of this is higher than 0, and the boolean "Built" is true, then subtract 1 from this variable.

    Once the Cooldown_Construction_Brand_New variable is 0, Person is not overlapping building and building is not a solid, set solid behaviour to Enabled and then regenerate pathfinding obstacle map.

    As for the person: I don't need the 8direction behaviour (since setting 8direction down would be bad if the building was against some sort of obstacle in that direction and they would not be able to leave it properly). The person will just walk out of the building in whatever direction they deem possible to get out of with their pathfinding behaviour and 'wander' status that I have set and because the building has not become a solid yet due to the cooldown delay, there are no issues with pathfinding, so after they are no longer overlapping buildings, I can set their collision and solid behaviour back to true (that's what the Still_On_Construction_Site boolean is doing when it goes to false).

    Here's a screenshot of my events. Please tell me if you agree with my solution or if there's something better:

    Edit: I made some adjustments because I realised that the last event is not going to work at all, haha:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • how about regenerating the obstacle map on completing the construction, but disabling the solid on the npc while overlapping with a building?

    Like I said previously, I was actually doing that, but it seems like the solid behaviour is still causing a problem with my NPC. I think our responses clashed a bit because I made a response just before you did. xD

  • Hey guys,

    Thanks so much for your quick response and advice, it's amazing!

    What you said makes perfect sense to me. I've just placed a "Regenerate Obstacle Map" action on an event after the building is finished. The only problem I have encountered now is that when a person finishes constructing a building, they are in the middle of the building when it becomes a solid, and even though I have set my person sprite to not collide with anything, and turn the person's solid behaviour off, they normally just walk out of the building (due to finding a new path with their 'wandering' status, but since adding that action, they get stuck inside the building and don't go anywhere. It's like the pathfinding behaviour just stops working after running the "Regenerate pathfinding obstacle map" action.

    Still it may be caused by the fact that my pathfinding sprite is whacked into the middle of a solid with no escape, so I had an idea; I tried using the 8 direction behaviour to get them to 'walk out of' the building but they just appear next to the building in the top left which is somewhat a solution because it enables them to return to their normal pathfinding behaviour and they don't get stuck but I was trying to get them to walk out of the building instead. I may have to delay making the building a solid until all people sprites are no longer overlapping the building after construction is complete.

  • Hey there,

    I am using the pathfinding behaviour on a sprite (that is a person) and I have buildings that are solid objects. Sometimes my people are set to wander around which means they will pick a random X and Y co-ordinate on the layout and the pathfinding behaviour will calculate a path for them to make their way to that point. When they reach that point they calculate another random co-ordinate and go there again. If the person collides with a building, they will get stuck like they are trying to go to a co-ordinate which is inside the building but they can't do it, nor does it stop and calculate a path to a different co-ordinate. My understanding of the pathfinding behaviour was that it cannot go to a co-ordinate if it cannot reach it like solids or am I misunderstanding that?

    What am I doing wrong?

    Thanks for your help!

  • After logging into Gravatar.com, I just made sure that not only the right gravatar was there but the right email address was added as well.

  • 1) No, I'm checking text size once but with 0.05s delay. If you remember, I mentioned earlier that you need to wait till the next tick to allow the system to render the text.

    After that I'm using Repeat 10 times to resize the bubble.

    Yes, I remember that. I was trying to do that in my example, but what I was doing obviously wasn't working lol

    2) I didn't understand why you had "Wizard & newline", that's why I removed it

    Oh fair enough. xD

    3) Global variable was just a quick and dirty solution.

    But yeah, you should implement something like this instead of calling a different function for every new dialog line.

    Thanks, I'll keep that in mind.

    What are you going to do with the Source_text object (black text)? You are using it to measure the text, but how are you planning to hide from the viewer?

    Well, from what I've worked out, I do need to have it in the visible screen. Obviously I don't want the player to see it, so I plan to hide it behind the background image when I get one made. =]

  • dop2000

    Thanks for revisiting me again.

    Sorry for confusing you. It wasn't my intention. There are a lot of variables which I was going to use and then stopped using, I just hadn't deleted them yet, and some that I am using but not in this example.

    From what I can tell with your edits (and correct me if I'm wrong):

    1) I wasn't checking the speech bubble size enough. I had to use the Repeat System condition so it kept checking the size after the function was called as I was not doing that initially.

    2) You cleared the "Wizard & newline" - Is it still possible to 'continue onto the next sentence' if the same person is talking without removing the person's name and having it to write it again and only clear what they are saying?

    3) I see you're using a global variable to track what progress the player is up to, then basically when the type writing effect finishes it allows the player to press space bar, adding to the global variable for TalkProgress, then calling a function to check what the next speech needs to be, then determining the speech bubble size. I should have thought of that.

    4) Thanks for fixing the indicator, that makes perfect sense. I honestly though I was doing that but in a different way and it just wasn't working.

  • Hey guys,

    Sorry to bump, but I am still having some issues getting this right and I have spent a great amount of time trying to work it out and it's driving me mad. I need some more of your awesomeness:

    In order to help me explain what I'm experiencing and what I'm after, here is an example:

    https://www.dropbox.com/s/s5zqnzf237tuz ... .capx?dl=0

    So basically what I'm after is for the speech bubble to grow (or shrink) to the appropriate size then the text to come out once it's done that. This also needs to happen after the player presses space bar to continue onto the next speech bubble.

    The text is coming out fine, the problem is the speech bubble itself. Basically it is not setting itself to the correct shape and size, and what I've noticed with the variables on the 9patch_points object where it determines the size of the text height and width of the Source_9patch_Speech does not update to the next text's height and width after the player presses spacebar for the next lot of text. The text should grow or shrink to the appropriate size depending how big the text is then it should start providing that text to the player if that makes sense. I'm also having problems with the Next_Indicator object, it seems to be completely out of place as well. It should be just short of the end of the speech bubble along the bottom and in the middle but underneath the text. For some reason I can't seem to get that right either and I can't place my finger on what it is that is making it go so wrong.

    The reason why I have everything going off 9patch_points variables is because I will be having multiple 9patch speech bubble colours for different things in my game, just so you understand.

    Your help again is much appreciate. Thank you!

  • Thanks Dop! That's got me on the right track.

    Edit: The effect I want though is for the speech bubble to grow somewhat slowly to the appropriate size of the textheight and textwidth and then display the text.

    Similiar to how it's done here:

    Subscribe to Construct videos now

    Skip to 3:24 of the video.

    Also considering that chat will take new lines when it becomes too long.

    I'm really sorry it hard for me to explain what I'm after, but I think this video does it.

    Edit: Thanks for trying to help again. I have worked it out! Once I determine the maximum size the speech will go to using the help in your example, dop, checking the textheight and textwidth, I have managed to expand the speech bubble accordingly to give it to the appropriate effect by increasing it by 0.05 of the maximum height and width, using a percentage instead so it always grows with the correct ratio.

  • I can get the type writer effect really easily. I have another object called the sourcetext object (which is off screen.

    My issue is determining the size the speech bubble needs to grow to so the width and height grow at the same time and both stop growing at the same time when its at the right size.

    I can do this if I can find out the width and height it needs to grow to.

    The width and height is going to vary.

    I did try setting the values of textwidth and textheight to a variable but it just gave me zero, even if I've got like 3 lines worth of text in the sourcetext object.