I have a fairly simple project with an clear goal in mind but am finding it oddly difficult to get a working output for some bizarre reason.
Basically, it is meant to be a game where you walk around and beat up enemies.
A new enemy spawns in each time you destroy 1 of them.
The game begins playing peaceful music at the start and when the player gets near enemies.. it fades out and fades in with action music.. once enemies are all gone it fades back to peaceful music.
**
When the player gets too close to an enemy it will randomly start attacking the player moving towards them in short bursts giving the player a chance to run away if they want to. **this part is not yet coded in**
Issues :
1)
I've tried to handle multiple instances using the "For Each Enemy" condition as the first one listed for each event where multiple instances of the Enemy Object will be referenced to, but this results in a rather long error pop-up in the Chrome Browser (the one I am using to test this in)
The only work-around I have found so far is to limit the number of IIDs that can ever spawn at any time and then list each one off. If there were a shorter way of dealing with this, I am all open to ideas.
2)
Sounds are not fading in and out correctly. I have tried to use an approach where the script seeks out the closest instance of Enemy and then determines its proximity to the Player sprite. I then set it up so when the player walks into range of any Enemy instance, the peaceful music fades out and the Action_Intro starts to play with its volume initially being an inaudible dB and gradually getting louder as the player gets closer to the target.
**needs to be coded still** Once the player gets within 400px of the nearest Enemy instance, the Enemy will attack the player randomly as well as move in short bursts towards the general direction of the player with random duration of pausing in between each charge attack. At the same time, the volume will stop getting louder and continue to playback at 0dB untill the player moves more than 400px away from the closest enemy.
If an enemy is destroyed, an invisible sprite is moved to the location of the destroyed Enemy. I then use this sprite as a "place holder" so the sound doesn't instantly cut off or glitch from 1 sound file to another abruptly but can make a smooth transition between them.
**need to add a bullet effect to the invisible Enemy_Ghost sprite so it steadily moves away from the player the moment it is positioned over the destroyed Enemy ... this will make the volume gently transition BUT only i no other enemies are within range of the player still**
That's pretty much it, perhaps there is a far more simple way to achieve what I am after here but since I couldn't figure any other way out, this was the best I could come up with.
I am secretly expecting that I've gone and made things far more complicated than they have to do and that Construct 2 is designed to automate a lot of the things I've tried to micromanage but I just am not sure how to access these things so they function as intended.
Please find the CAPX file linked below :
http://www5.zippyshare.com/d/82926545/508/Street%20Thrash%20Game%20Demo.capx
p.s. there is this odd gap between loops of the audio files and the actual sound files have no silence top or tail so it shouldn't be happening.. if anyone knows why construct 2 is adding this gap of silence between each loop of the files that would be great to know.