jmay1982's Forum Posts

  • 7 posts
  • i've made an example for you, it works quite well i think, fires according to the player angle - reminds me of the wookie gun from battlefront 2 :3

    https://www.dropbox.com/s/lfl7wit7pdix35i/gunspray.capx%20

    Yes, this works brilliantly! I was able to shorten it by using loops in each of those branches, but the concept is the same. Thanks man!

  • In my game, I have a feature where the player can hold down the mouse button and every second it is held down, they will gain a charge level (up to 5).

    I'd like to create an arc of projectiles with the current angle of the player as the center of the spread. I've tried a lot of different ways, and this is the current, but it's not working well at all. It's a bit wordy to explain what I've done, so here's an image of the relevant events (in red boxes) along with some context.

    edit: For some reason, the forum makes the "N" at the end of the URL lower case if I try to link or embed the image, so you'll have to copy/paste. Sorry.

    i.imgur.com/5culoNK.png

    Any other ideas?

    Thanks!

  • You'd pass the UID to the function and then in the function have:

    BadGuy: Pick by UID Function.Param(0)

    Thanks! Guess it needed to be added as a sub-event, but that did the trick!

  • Yes, I think adding an additional condition that says BadGuy.health <= 0 will work. I guess behind the scenes it would be doing a loop over each object in the family and performing the actions if they meet the condition, so not quite as efficient as specifying the UID and avoiding the loop, but I doubt I will see performance issues with this particular game.

    I'd be interested to know if there are other ways to accomplish this (or if I am wrong in my assumption about how it works) since I imagine this is a situation that is fairly common.

    Thanks for your help ;)

  • Hello,

    I have several types of bad guy that may be on the screen at once. They belong to a family ("BadGuys"), and there are various conditions under which they may be destroyed. When they are destroyed, we do a few actions (animation, sound, destroy object). So, I'd like to stick those steps in a function and call that function whenever a bad guy meets a condition for destruction.

    What I find is that calling BadGuy.Destroy from a function destroys all the objects in the family, rather than the one that caused the event to trigger. So, I thought I'd pass the BadGuy.UID property in as a param to my function, but I'm not really clear how I can use it on the other end to tell it to only destroy this instance rather than all of them.

    Any help is appreciated!

    Thanks.

  • >

    > So, I could use instance variables specific to each enemy, but then I can't access it through the family. I could set a family instance variable and let it be inherited by the objects in the family, however that would effectively set them all to the same health.

    >

    >

    You can actually do this.

    Create a family, add objects and shared variables into it. Now go look into objects variables in the editor and you'll see the family's variables in the objects properties. You can set them into whatever you desire, so different enemies can have different health by default. :)

    AHA!

    I had actually tried this before posting, however I was looking at the instance variables for the object, not in the properties panel.

    So now my event looks like:

    Bullet on collision with BadGuy: Subtract 1 from BadGuy health.

    Now that I can set the health for each type of bad guy independently, this works out perfectly.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    This seems basic to me, but I haven't been able to find the answer in the manual, tutorials, or forum, so here goes.

    I am doing my own version of the "ghost shooter" game from the beginner tutorial. I would like to have multiple types of enemy, each with their own health pool (some higher, some lower).

    I want to take advantage of families so that I don't have to re-create the events dealing with enemy collisions or enemy death. However, on collision with the good guy's weapon, I need to decrease the particular enemy's health by one.

    So, I could use instance variables specific to each enemy, but then I can't access it through the family. I could set a family instance variable and let it be inherited by the objects in the family, however that would effectively set them all to the same health.

    What I'm looking for is a way to drill down to the particular object instance within a family that triggered the event and access its instance variables. Any ideas?

    Thanks!!

  • 7 posts