mekonbekon's Forum Posts

  • Yeah, maybe a bug then - does it work properly in C2?

  • stevecameron

    Nice start! Maybe add in a collectable object for a score bonus? That would introduce a nice risk-reward mechanic. A couple of other suggestions for simple improvements would be to include an in-game timer so that player has an indication of their progress, and a death animation on the avatar. Looking forward to your next creation!

  • Have you tried "Set Canvas Size"? If you then want the pixels to scale correspondingly you can set the Layout scale.

  • I'm glad that the preloading worked for you - if it takes too long to load you can break up the preloading of sounds into groups using the preload action at the start of the different layouts rather than preloading them all at the very beginning.

    Thanks for sharing the link, the game is looking good - nice work!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm...

    I set up a test demo but couldn't replicate the bug.

    A couple of other thoughts:

    1) Are all the sounds preloaded?

    2) Have you tried spitting out some debug text to check whether (i) the event isn't triggering, (ii) the audio action isn't triggering, or (iii) the audio event is triggering but no audio is playing? You could do this by including an action in the event playing the audio that adds the current time to a text object. If there are gaps in time sequence then it must be the case that the event isn't triggering, but if the time is always added then you know that the event triggers ok, so it must be an issue with either case (ii) or (iii), in which case you can run the game in debug, select the audio object and watch it - if the object registers as playing when you get the bug then (iii) is the cause, otherwise it's (ii).

    Apart from that I'm stuck too, sorry I couldn't be of more help :S

  • imhotep22 I can't see anything obvious, but there a couple of avenues that might be worth be pursuing:

    1) The "every 2 seconds" - I don't think this triggers immediately but only after 2 seconds have passed i.e. it won't trigger on 0 seconds. That may of course be your intention. I'm guessing you're using two second loops? If so, have you considered using the 'on "(tag)" ended' condition? I also have a hunch that the order of the every X seconds in the event might cause issues: does "on X seconds | Var = Y" always do the same as "Var = Y | on X seconds"?

    2) Is the audio sample that doesn't play random, or is it always the same one(s)? If the latter is the case, have you checked that all the audio samples work and, if you're relying upon them being the same length, that they are so? I've had situations where I've been checking a sound after a given duration presuming that it's exactly X seconds when it's been a fraction over, throwing everything out of sync. Btw, using round(1,8) means that the values 1 and 8 will be chosen half as often as the other values; floor(1,9) would give you an even distribution.

    Edit:

    I'd be inclined to ditch the function "On Play_background_music" and go for:

    Audio: On Ended "Background_music, bgMusic=0, Current_layout > 0, Music_is_muted = 0 | Audio "music_" & floor(random(1,9) not looping (tag "Background_music")

    ...and then toggle bgMusic when you stop the background music to prevent it looping.

    Edit 2:

    Of course you'd need to trigger the background music to start from somewhere for that to work

  • Sorry, that's not entirely correct - you'll need to make another change:

    Events 4 -6 in your code should be under another main event:

    obj_player is playing "ID_SHOOTING"

    Adding the "trigger once" to Event 2 will prevent the ID_SHOOTING animation from triggering and resetting to normalAttackAnims every tick.

    Adding the new main event means that the code will only check the animation frames while ID_SHOOTING is playing.

  • Looking at the code from the first video, I think your problem may be that the event 2 "Is shooting" condition will trigger every tick until frame 3 is reached. Try adding a "Trigger once while true" to that event - you can combine them rather than making it a sub event but make sure it follows on from the "Is shooting" condition e.g.:

    Event 2: obj_player | Is shooting | trigger once whilst true

    Not:

    Event 2: obj_player | trigger once whilst true| Is shooting

    If you PM me the code I can confirm for you that this is the case.

  • imhotep22

    Cheers! Yes, definitely loads to do .

  • saravanakumar

    Sorry, wish I could help but I don't have any experience porting games to facebook - I hope you get a response though.

  • Is it that you want the bullet to spawn from the gun on the detonation frame (frame 1) rather than the 1st frame (frame 0)? If so, you could use something like this:

    1. On shoot key pressed | set playing sprite animation "shoot" from start.

    2 If sprite.animation "shoot" is playing, if sprite.animationFrame = 1 | spawn bullet from sprite at (gun origin).

    You will need to add an origin point at the position of the barrel of the gun on the sprite, where you want the bullet to spawn from.

    A word of warning about spawning the bullet partway through an animation: unless your animation is very quick and short (or you have a deliberately long wind-up phase for your shot) it is best to spawn the bullet at the first frame because otherwise you may be introducing a noticeable lag into the shooting mechanic, which can make the game feel unresponsive.

    If this isn't what you're after please could you link to specific video you're talking about, or include a capx?

  • Hi saravanakumar - you're best off opening up a new forum thread on the "How Do I..." board rather than commenting in this one - include a description of the problem, with a capx if possible, and you'll be more likely to get a useful response.

  • kiko2015

    I use this system for randomizing arrays:

    https://www.dropbox.com/s/h8pmfmjgfkvu8 ... .capx?dl=0

    Event 2 just fills the array with stepped data - you can substitute this event for your array data.

  • Hey, thanks stevecameron

    Yeah, it's amazing how much of a difference just adding a little bit of "juice" can make to a game.

  • Hi Youtopize,

    Sorry, I don't know of other ways to handle the 3D data that are compatible with C2.

    Using a JSON 3D array is probably your best bet (unless any kind souls on the forums have an alternative). It really doesn't take that much more time to enter data into a json than it would using a spreadsheet system and it also has the advantage that you can format the data with returns, tabs and spaces to make it more legible and suited to the type of data you're adding. If you want any help with the formatting I'll be glad to assist.