Mallets's Recent Forum Activity

  • The manual actually describes this problem as follows:

    [quote:2njbc6o1]Set volume

    Change the volume of a sound. The volume is given in decibels (dB). A volume of 0 dB is original volume, and below 0 dB attenuates the sound. Note amplification is not supported. For example, entering a value of -10 plays the audio back 10 dB quieter (about half as loud).

    Note it is best to set the initial volume in the Play action instead of setting it with this action immediately after playing, since that can sometimes cause a moment of playback at the wrong volume.

    The problem is that I'm doing exactly what is recommended here, but getting this exactly issue. If the volume for effects is set to -60 after previously being set to 0, then it will play at 0 for a fraction of a second (maybe 1 frame/tick), and THEN play correctly.

    When I want to play a sound effect, I call a function that is responsible for every sound effect, and make Parameter 0 the filename of the sound effect to play. I specify the volume at the same time as the name of the sound effect to play, i.e. all in one line and not sequentially in two actions.

    Pseudo-code (I use a slider to universally control the volume of all sound effects when they play):

    On click sprite:

    --Call function "PlaySFX"

    On function "PlaySFX":

    (sub-events):

    Param0 = Sound1 --> Play sound effect 1 at (sound effects slider volume) dB

    Param0 = Sound2 --> Play sound effect 2 at (sound effects slider volume) dB

    etc

    etc

    etc

    Thank you.

  • Has anyone ever encountered this before? I still can't quite figure out what the issue is. It's even mentioned in the manual that setting the volume even in the next action after playing a sound will cause this, but in my case, it's all happening on a single event line.

  • Hello,

    I'm working with music and SFX sliders and keep running into a problem where audio that shouldn't be audible is, but only for a fraction of a second. When the SFX master volume is changed from 0 to -60, if you play a sound effect, it seems to play at full volume for a tick before correctly playing (at -60 dB).

    The image here shows all the relevant code for adjusting the volume as well as a graph to show you what the problem is versus what I would expect to happen. The image seems to be getting cut off here, but the full image is http://i.imgur.com/QMhiVgk.png

    If anyone has any idea about why this might be happening, I would be thrilled to hear your thoughts. Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using the same events and layouts, the gamepad (Xbox One controller) only works when the debugger is used. It works perfectly too. When I reload the same layouts and project in the regular run mode, the gamepad fails to respond at all to any inputs.

    I'm not aware of any conditions or actions that affect things only when in debug mode, so I have no idea what in the world is happening. I don't even know where to being bug-testing because there's no single group or event that I can start from.

    Thank you!

  • Hello all,

    I am using Drag and drop with the "rope" in the image below. The idea is that you grab the rope with the mouse, enabling drag and drop, and can pull the brown sprite down. But occasionally Drag and Drop will break -- it no longer functions and instead, the mouse mouse cursor changes to this:

    I have found that this cursor icon also appears in other applications when swapping objects (such as menu items), but I have no idea why it is sometimes triggered in C2, and why it causes D&D to no longer work when it shows up. It usually happens when you get rough with the rope (as in, I was trying to break it to test for bugs), going very fast or having the mouse leave the game window while drag and drop is active.

    I'm running in NW.js. Thank you!

  • Ah-ha! Well, I'm sorry to have taken your time, but it's finally working. I could swear that second " was there the whole time. Anyway, thank you!

  • OK, that should be good to go, but I now think the true problem lies with importing the dictionary from a JSON string. I'm having trouble successfully loading the dictionary. As other threads have concluded, "Load from JSON string" requires double quotes.

    This topic in particular:

    The dictionary string is currently entered like this (this is exactly how it is written into the dialogue box for "Parameters for dictLevelNames: Load")

    "

    {""c2dictionary"":true,""data"":

    {

    ""0"":""zero"",

    ""1"":""one"",

    ""2"":""Tower",

    ""3"":""Cave""

    }

    }

    "

    but when I check the dictionary in Debug, it still shows as having 0 keys and being empty.

  • So I have a dictionary for each level and the level's name. For example, key 0 has a value of "Jungle," key 1 has a value of "Castle," etc. I want to display both of these things in a textbox on-screen, so I use this:

    (LevelNumber is a global variable)

    For textbox, set text to:

    "Level" & LevelNumber & "-" & dictLevels.Get("LevelNumber")

    This works fine except that the "Get" portion just returns 0 (because there is no key with the name "LevelNumber," I understand this part). I want the "Get" value to choose the value for the key that is currently equal to the global variable LevelNumber, but because the key is a string, I'm having trouble figuring out if there is a way using str() or int() to get this done.

    Long story short, when it's Level 3, for example, the global var "LevelNumber" will always be 3, and I want the text to "Get" the value for Key entry #3 and display that too.

    Thank you!

  • The audio plugin doesn't seem to have any way to return filenames (according to the manual page). Here's what I'm working with:

    When "On 'tracks' ended" is triggered, I want to prevent the same song from playing twice in a row. Ideally I want it to call a function like so:

    [quote:3qb4ll9b]On "tracks" ended:

    --Call function "AudioShuffle"

    --Set Parameter 0 to "(name of audio track that triggered this call)"

    On Function "AudioShuffle"

    If Param(0) and audio are equal, call the function again.

    Else, play (choose(track1,track2,etc))

    Yes, you could do this in a dictionary or array as well (toggle from 0 to 1 for "chosen track" to stop it from repeating), but I would be surprised if there were not a way to do this as the events currently are. Thank you!

  • I believe the 'system trigger once' is causing your problem in the 'for each' loop. I'm thinking that will run once at the beginning of the layout and never run again because of the 'trigger once'.

    ...

    Also, in the function, you don't pick any of the enemies so it most likely will pick all of them. So each time one enemy is supposed to fire all of them will. (Pass the UID of the enemy as a parameter of the function then 'pick by ID' as the first sub-event)

    I did indeed condense those two events, but "trigger once" must be present or else when the angle of motion is picked for each instance of the enemy, it's picked every tick (the enemy sort of vibrates in place when this happens). I made that its own sub-event, though.

    As for the function part, I'm not great at intuiting function parameters, so I may have done this incorrectly. Calling the function now looks like this:

    Call function "8DirShot" (sEnemyFlyer.UID) . When the function "8DirShot" is called, Parameter 0 is (sEnemyFlyer.UID).

    The conditions when the function is called are now set to this:

    On function: "8DirShot"

    Pick sEnemyFlyer where sEnemyFlyer.UID = Function.param(0)

    For "" from 1 to 8:

    Is this closer to what you meant with your suggestions? And yes, timers are a wonderful thing, and I'm combing through and trying to replace "wait" with timers wherever possible. Thank you so much for all the help so far.

  • Greetings all,

    I'm having a bit of trouble when using an enemy spawn sprite to spawn multiple instances of the same enemy. As each one is spawned every few seconds, I want each one to behave independently. choosing its own direction and amount of time to wait. I've checked through many existing topics on this forum already and have attempted those solutions, but still can't get it quite right.

    The code in question involves these Spawn sprites and these sEnemyFlyer sprites in the code below. The first small bit is the code for the spawner to spawn the sEnemyFlyer enemy. The larger bit below the black line is the AI that each sEnemyFlyer should adopt and use.

    Here's what I would expect to happen:

    1) As each Flyer is created from the spawned, it first checks the "On created > sEnemyFlyer" Event, then does all the actions in that event including settings its own instance variable for "AI" to 0.

    2) When that instance of the Flyer enemy sets its AI to 0, it then trigger the next event once, choosing a direction, waiting a random amount of time, then switching to AI =1

    3) After doing all the actions when AI = 1, it should switch back to AI = 0, resetting the animation and starting over.

    The problem here is that none of the enemies created by the spawner behave correctly: they don't appear to inherit the "On created" actions, and only travel at 0 degrees at their Bullet.Speed value, ignoring the entire AI loop. The only case where this enemy almost works is when an sEnemyFlyer is already present on the layout at the start. In other words, the only one not spawned from the spawner sprite.

    I would tend to think this is an issue of picking combined with the "For each" loop, but no matter how I configure it, I can't seem to get these enemies behaving properly and independently. If you know of any solutions, please share them. Thank you for taking the time to read my question!

  • Hello all,

    We all know that the best practice for organizing a project is through folders and sub-folders, categorizing project objects as neatly as possible. I'm currently working with a project that has several hundred sprites within 15-20 different folders. Every time there is a new sprite that needs to be moved to a folder, I have to drag it upwards to find the correct folder. After dropping, affected folders and sub-folders expand, cluttering up the view. Furthermore, you can only drag-and-drop one object at a time, and there is no way to shift+click to select multiple objects at once.

    This makes dragging sprites to the correct folder quite unpleasant because you can't quickly identify the correct folder by leaving it as the only expanded one, and increases the distance and time taken to drag a sprite upwards through the projects tab. The most obvious solution here is to always create objects in the correct folder to start with, but I'm collaborating with others and it's not always feasible to do this.

    I don't know if any sort of plug-in exists to improve the Projects tab functionality, but I would love to hear your thoughts on whether you have had a similar issue in your projects.

Mallets's avatar

Mallets

Member since 16 May, 2015

None one is following Mallets yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies