CJacobsSA's Forum Posts

  • Quick double post to say that if there is another method of making them not overlap that doesn't involve the solid behavior, which would sidestep this problem, I will take that as an answer too!

  • Hi, I've got a strange problem and I'm not sure what holes in my logic are causing it. Basically, my enemies are set to pathfind to the player when they are in range, stopping and setting a new path every second or so or when they stop. However, if an enemy cannot find a path when that time arrives, it does not try again when the timer expires, instead this happens:

    and it stays this way. After this, they stand still permanently. They still detect the player and the relevant "chase the player" variables still function, but the pathfinding itself does not.

    I have a hunch this is happening because the enemies are solid or obstacles of each others' (so that they don't overlap), because it works just fine with I disable those behaviors. Thus, they try to path around each other to the player but cannot because other enemies are in the way, so they stop and then for some reason don't start again. Here is a big ol' image with all of the code for the enemy:

    Any ideas as to why it's happening and/or how I can force them to recalculate? I thought I was already doing that with line 163 but perhaps not.

  • I'll give that a try, then. Thank you for the help!

  • Interesting, that makes sense. Is there a way to do it so that I only need one bullet object for A and B? Or will I need to create a new object for each one?

  • I see! How would I go about applying different values to different bullet/enemy types? For example, the same kind of bullet comes out of two different guns, but I want them to do different damage amounts. Similarly, enemies in the same family having different health values.

  • Hello, I'm looking for a bit of help with keeping my code from having to be repeated multiple times (possibly using Families?). My game is going to have multiple kinds of enemies, and different types of projectiles the player can fire, with a few shared variables between all of them. Every bullet has a 'DamageDealt' instance variable, and every enemy has a 'CurrentHealth' variable, and so on. The way I have it set up now is as such:

    The problem is that I don't know how to avoid repeating this code for each type of bullet and then repeating that for each type of enemy. How would I go about doing that? I tried using families, but I can't figure out how to address the instance variables of something in the family, only the family itself.

  • Thank you both, those are very helpful examples!

  • Hello, I've got a logic problem that's causing me to scratch my head but I'm not sure what exactly I would need to do to solve it. In my game the player can obtain upgrades to their arsenal that are the same weapon type (dual pistols, multiple shotguns, and so on). I'd like it if I could combine the weapon select buttons so that the player doesn't have to reach across their keyboard to switch. For example:

    Press 3 once, your character pulls out the single shotgun.

    Press 3 with the single shotgun out, your character pulls out the double barrel.

    Press 3 with the double barrel out, your character pulls out the automatic shotgun.

    I've tried to emulate it here:

    But obviously this doesn't work because the 'else' statement causes weapon 5 to never be selected. What would the proper way of coding this be?

  • Ahh, that's a bummer, but oh well. Thank you very much for the help, it proved super useful.

  • Interesting! I decided to go with giving each object an ID variable and that works great. Now, with that in mind, is there a way to spawn them with an incrementally increasing ID value, so that I don't have to drag in a bunch of em manually to the layout? Eventually there'll be dozens of upgrades to choose from and it'd be kind of a pain. That'd be ideal.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I'm a little bit clueless on the proper way to accomplish the thread title and I'd appreciate a bit of help.

    In my game, the player can purchase upgrades by clicking buttons like these (ignore that the icons on the button are the same, that's just for testing). This is actually three objects: The button itself, the text denoting the price, and the sprite in the top right that indicates whether the upgrade has been purchased. For reference, the buttons are placed by hand on the layout, while the indicator is spawned:

    The problem I'm having is that I have no idea how to link these objects together. I just don't know how to make a specific button and a specific indicator be tied together when it spawns so that when the upgrade is purchased, the indicator changes. How would I go about doing that?

  • Got it, thank you. Would you happen to have any organization tips? Because this

    is kind of a mess and hard to keep track of. Also, how do I make these values initialize to these only once, ever, instead of every time the player visits the layout?

  • That does sound like a good idea since the player will be able to save the game etc, but what do you mean by incrementing and decrementing the cell values? Do you just mean making an event that sets it to "(whatever it's at)+1" upon picking up the power-up and then another for "(whatever it's at)-1" when it wears off?

  • Hello, I'm having an issue sorting out the logic with making a power-up for my game. Basically, when the player collects the power-up, a bar is filled that slowly empties. What I want to have happen is, while the bar is not empty (i.e. has a width greater than zero), the player has 1 point added to one of their stats. I'd like to do it this way so that the bonus does not stack if they collect the same power-up multiple times, therefore it only applies once while true.

    This seems like it would be pretty simple but it's turning out to be kind of hard to wrap my head around, namely because I don't know how to do truly temporary additions to variables- as in, not using two different events to add the bonus stat point and then subtract it again when the bonus runs out. If that's the only reasonable way, feel free to let me know how to do that, but I'd like if there were a more elegant solution that only took one event.

  • Ah, I figured out where I was going wrong. The button's 'upgradetoadd' variable was a number, not text. Upon changing it to text, Magistross' clarification works just fine. Thank you both for the help!