Sam Mortimer's Recent Forum Activity

  • Oh right. Have you tried 'choose()'? It randomly picks one of the values between the brackets, e.g. choose("Yes","No","Maybe") could give 'Yes', 'No' or 'Maybe'.

  • Say you wanted the player to always be in the centre of the screen. Instead of giving the player the ScrollTo behaviour, I would give the behaviour to a separate object called Camera with an instance variable called something like 'ShakeY'. Every tick, set Camera position to Player.X,Player.Y+Camera.ShakeY. When you want to shake vertically, some how or other set the value of ShakeY to something random and crazy a few times then reset it back to 0. Easy!

  • In debug mode, not all the audio that's playing is actually listed under Audio. Construct 2 doesn't seem to realise that the tags "1a" and "1e" are playing at all, which would explain why it can't sync them up. So, why can't Construct 2 keep track of what is and isn't playing? How can I fix/compensate for this?

  • Well for a random value, use random(x) for a number from 0 to x, or use random(x,y) for a number from x to y.

    I have no idea about high scores and stuff.

  • My little dynamic soundtrack thing I'm doing needs the looping sounds "1a" and "1e" to always be in sync.

    1e will begin while 1a is already playing. When 1e starts, the tag seeks to Audio.PlaybackTime("1a") seconds.

    Then for good measure, if Audio.PlaybackTime("1e") doesn't equal Audio.PlaybackTime("1a"), seek "1e" to Audio.PlaybackTime("1a").

    For some reason this doesn't take effect until I click outside of the window (freezing the game) then click back in, at which point 1e will immediately jump to where it's supposed to be.

    What the hell could be causing this issue? It's making the music sound atrocious. Please help!

  • Thanks for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does 'for each' mean 'Repeat this action on every single instance of the object' or 'Repeat this action for every instance of the object that fits the conditions'?

  • What the fuck. How have I never noticed this 'for each' thing? This makes everything ever so much easier. Jesus christ.

  • The character limit makes it a bit hard to explain my problem in the topic heading.

    I'm making an endless-runnner with a car object that you run past from time to time. Basically I want each instance of the car to play a looping sound that starts when the car is first on-screen, becomes louder based on how close Car.x is to scrollx, and stops when the car is no longer on screen. The sound must also be muted and unmuted based on the local value 'sound'.

    I've given the Car object a boolean value called 'IsPlayingSound'. If the boolean value is false and the Car is on-screen and the local value 'sound' = 1, then the sound 'Car' is played looping with the tag "Car"&Car.uid.

    If the local value 'sound' = 0 (so that the player can mute the sound if it's annoying them) and 'IsPlayingSound' is true, then the boolean is set to false and the tag "Car"&Car.uid is stopped.

    If Car is not on-screen and 'IsPlayingSound' is true then set it to false and stop "Car"&Car.uid.

    And finally, if Car is on-screen and 'IsPlayingSound' is true then set the volume of "Car"&Car.uid to a little maths equation that makes it louder when Car.x is closer to scrollx.

    It all works surprisingly well, apart from when I try to stop the car sound if the local value 'sound' =0. The value can be toggled between 1 and 0 by pressing N so that the sound can be muted by the player.

    This works when one car is on-screen, however when more than one car is on-screen then only one of them has the sound stopped while the others continue to play.

    I'm sure that this shouldn't happen. If I've written If 'sound' = 0 and Car IsPlayingSound, then set IsPlayingSound to false and stop tag "Car"&Car.uid then surely it should affect every car? It should go through each car which 'isPlayingSound' one by one and set the boolean to false and stop the sound, right?

    I could easily solve this problem if sounds could have multiple tags. Every sound would have two tags, "Car"&Car.UID and just "Car". That way I could start, stop and control the volume of each sound using "Car"&Car.UID and I could mute/unmute every sound when the player presses N using "Car".

    Except I can't do that be because obviously Construct 2 doesn't support multiple audio tags. So, does anybody know an alternative solution?

  • WAIT.

    I tried moving all the music into the sounds folder and now it works a dream. Apparently all those tantalizing audio actions like 'set volume' only apply to 'sounds', not 'music'. Very strange.

  • I play looping music at -20 db with the tag "1b". I say 'every tick, set "1b" volume to 0db'. The volume is still -20db. Jesus christ, I'm trying everything but I just cannot get this horrible software to change the volume of a sound. Help, please.

    I started off with looping music that starts at -50db in one layout, then in the next layout the music's volume is set to the value of a global variable. The music track was supposed to get louder the longer the player is in the air, Portal-2-gel-style, so this variable decreases while the player is on the floor and increases otherwise.

    This didn't work, so I thought that either A. my variable isn't doing what it's supposed to or B. Construct 2 is forgetting about sound that started playing in a different layout. First I tried replacing 'set volume to the-variable db' with 'set volume to 0 db', which didn't have any effect.

    Then I tried starting the music on the same layout in which its volume is altered as opposed to starting it in the previous layout and then altering the volume in this layout. Didn't help.

    I'm out of ideas. If anybody knows why on earth Construct 2 wouldn't respond to the straightforward, "On start of layout play music at -20db, every tick set volume of music to 0db," please tell me.

  • Oh, of course! Only check vector Y while the player's falling. Duh.

    Thanks a bunch.

Sam Mortimer's avatar

Sam Mortimer

Member since 7 Nov, 2013

Twitter
Sam Mortimer has 2 followers

Trophy Case

  • 11-Year Club
  • Popular Game One of your games has over 1,000 players
  • Email Verified

Progress

13/44
How to earn trophies