pandabear7413's Forum Posts

  • So maybe I'm just not understanding how initial value of instance variables work!?!

    I cracked open the archived layout.json files and pulled the i.v. values I had been using, so I'm good there (I had lots of specific cryptic values I wouldn't be able to remember).

    More importantly, I was assuming that the "initial value" operated like a "default value", meaning that value would be inherited by the corresponding i.v. of any object in the family when created. Instead it seems like C3 has a different, rather confusing way of inheriting values, and the initial values are specific to the object instance. This post goes into detail:

    construct.net/en/forum/construct-3/how-do-i-8/instance-variable-initial-139702

    Looks like others have been confused by this concept before, I haven't seen it called out in the documentation so an explanation in the docs "instance variable" section would probably be helpful to other newbies like me.

  • See edit below, but this was my original problem...

    I have a family of enemy objects called 'enemies'. Enemy objects are sprites, and I have 2 different enemy types in the enemies family, a zombie and a werewolf. The enemies family has an instance variable called health, and I want to set the default value to 2.

    If I edit the family instance variables, the health IV shows 'varies', even though I have no instances of the enemies objects in any of my layouts. If I try to set it to 2, when I hit enter it goes back to showing 'varies'. If I add a zombie or a Werewolf to my layout, they have a health of 1. If I change their health to 2 and then add another of the same enemy type, the new enemy has a health of 2. But if I delete all instances of that enemy type and then add a new one, its health is set to 1.

    Edit:

    OK, so now I'm REALLY tripping out! I just saved my project, reloaded C3 in my browser, and reloaded my project, and now all family instance variables are set to 0 / blank strings and I can't change their default values!!! If I create a new i.v. I can set it's value properly, but I can't set values for any of the existing i.v.'s. Man I hope someone knows how to fix this and I don't have a corrupted project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have an audio object, and it is set to play a specific sound based on the game situation. How can I determine what sound / sound file is being played at any given point?

  • I currently am on a monthly individual plan and want to upgrade to the annual plan. I don't see a way to do that. Maybe I just need to wait until the last day of my paid monthly subscription, cancel it, and then buy the annual plan?

  • I made some changes to my project recently and it seems the audio's not working the way it was before. It may be a browser issue and/or I'm not remembering things correctly, but I want to make sure I'm avoiding any future issues. Here's what's happening:

    • Action: I press F5 in the c3 editor to preview layout
    • Result: audio works as expected
    • Action 2: Without interacting with the preview window / browser in any way, I press F5 to reload the preview window (preview window is the window with focus, not the c3 editor)
    • Result: audio is muted until I interact with the window, at which point it sounds like the audio's trying to 'catch up' (plays sounds that should have occurred a few moments before

    Does this sound normal, and is there anything I can do in the code to make the audio always work in the preview window?

    Thanks

  • My sprite animations have multiple image points representing different things, like hit box locations and where to spawn explosion sprites. The IPs are consistently named (e.g. impactPoint, explosionPoint). But the IPs vary with different instances / animations and only exist on certain frames.

    I'm looking to implement logic like:

    if (animation frame has image point "imagePointName")

    do something at image point "imagePointName"

    However, I don't see a way to find/identify IPs by name, only by number. And this doesn't work since the number isn't tied to the IP name. E.g., depending on the number of IPs in the individual frames, on frame 1 the "explosionPoint" may be IP 1, but on frame 2 the "explosionPoint" may be IP 2.

    Thoughts on how to achieve what I'm looking to do?

  • I'm loading array data from a .json file using the AJAX object. I'd like to modify that .json file at runtime and reload the new data into the array at runtime as well. I'm using the Array editor to modify the .json file and save it. The file itself has been modified, but when I try to reload the .json file into the array the array data is unchanged. It's as if the .json file is cached at startup and cant be changed during runtime. FYI this is not functionality I plan to allow in the final game, but it helps me debug during development. And I'm running this in Chrome.

    Is this expected behavior, or am I doing something wrong? There's mention of file access available when exporting to NW.js, is that required for this file-reload functionality?

    Thanks

  • PERFECT!!! Setup with github now, thanks guys!

  • Curious if folks have recommendations on a source control system to use when developing w/ C3? I have no SCM experience but figured I can give it a go. The team is just me and I don't see expanding the team for at least a year.

    Thanks

  • Well that certainly answers my question! I guess I could have tried that before overthinking it. Thanks!

  • I'm just starting out on a platformer and I'm currently using a single Audio object to handle all audio for my game. However, it's becoming difficult to manage the timing of all the different audio (player voice, enemy's voice, sound effects) with the single Audio object. Is there a best practice for how many Audio objects can/should be used in a game? Should I try to use just one, or should I have separate ones for the player, each enemy, sound effects, music, etc?

    Thanks

  • Sorry it took so long to respond (had just left for vaca) but this worked like a charm - thanks!

  • I want to play a punch sound on specific animation frames. If I use the following, I get an echo effect because C3 plays the sound once every 1/60th of a second that the animation frame is playing:

    I can do the following, which will prevent the sound from playing again until it has completed playing:

    However, this wont work as I do want some overlap, and I don't want to wait for the full punch audio to end before I can play another. The best solution I came up with was:

    I'm not a fan of this option, since I'll have a lot of sounds playing and will need a lot of these soundPlaying variables to keep track of. It's just not very clean.

    Is there an easier solution?

  • Thanks, that worked!

    My game has several functions, with some functions being called from others. So when using families, is the rule to ALWAYS use a for/each condition when calling a function that performs actions on the family members? Does this apply when calling functions from functions? Or should I try to minimize functions use entirely? I'm using functions to keep my eventsheet clean, but maybe I shouldn't?