How do I... (Instances in a space-invader type of game)

Get help using Construct 2

Post » Wed Nov 25, 2015 12:56 am

Sure thing. If you have some trouble, make sure you print your screen. It'll really help us work out what you're doing right/wrong.
Image
B
11
S
4
G
1
Posts: 30
Reputation: 921

Post » Wed Nov 25, 2015 1:25 am

Image

So I've popped in the system with the enemy music variables, but if the spotlight moves left or right with the lowest instance selected, the next instance up begins to pulse and play a note :(

(and I just realized I'm not even calling the highestY variable :oops: )
B
5
Posts: 12
Reputation: 249

Post » Wed Nov 25, 2015 1:37 am

I'm not able to duplicate your problem on my end. If you don't mind, you should attach your capx.

P.S. Don't worry about calling the highestY variable. It is only used in the loop. Think of the UID variable as the 'result' we want from the loop, with the highestY variable just a means of getting it.
Image
B
11
S
4
G
1
Posts: 30
Reputation: 921

Post » Wed Nov 25, 2015 1:49 am

https://www.dropbox.com/s/8smmqui3o80nh1r/musicalspaceinvaders.capx?dl=0

Here's the capx. I'm hoping to finally sweep the issue under the bed 8-)
B
5
Posts: 12
Reputation: 249

Post » Wed Nov 25, 2015 2:36 am

Yes, I think I've worked out what's going on here. Correct me if I'm wrong, but I believe that you are getting the 'double pulse' when you move the spotlight off the lowest enemy and onto another with no gap between them. So, if the two enemies had the same Y coordinate they would overlap (See below):
Image

This is caused by your 'Else' function which disables the Pulse effect. The Else function only triggers when the condition: "Enemy is overlapping Spotlight_Detect" is false, but because there is no gap in between the two, it never triggers. Therefore, the first is still pulsing because it was never told to stop, and the second is pulsing because it is correctly the lowest now. In fact, the first is no longer even in the loop because it's no longer in the spotlight. That means we have to deal with it in another block. This can be a little tricky so let me take some time to think about it.
Image
B
11
S
4
G
1
Posts: 30
Reputation: 921

Post » Wed Nov 25, 2015 2:52 am

I really appreciate the time you're putting into this to help out, Voulk.

It just happens to be one of the last pieces to put together for the project - and as soon as its finished, hallelujah.
B
5
Posts: 12
Reputation: 249

Post » Wed Nov 25, 2015 3:12 am

Phew, that was a tricky one.

Image

This will need to be tested quite comprehensively but I'm not seeing any issues so far. Here's how it works:
1. We are now storing the Music Type of the enemy when deciding which is the lowest, we're going to use this in a bit.
2. We have added the 'pick all enemy' block. What this does, is removes the 'must be in spotlight' condition we started with, so that we can test enemies outside of it.
* Any that don't have a matching UID (That is, they aren't the lowest) will stop pulsing.
* Additionally, this loop will stop any other music types. This has the advantage of keeping the 'green' sound if you mouse from one green to another without a space.

Off-screen you want to keep the current Else block you have also, since that will trigger when we have no enemies selected at all which is something we still want.
Image
B
11
S
4
G
1
Posts: 30
Reputation: 921

Post » Wed Nov 25, 2015 3:30 am

So close!

I was just testing it out and if two colors overlap in the spotlight, if the bottom one is spotlighted first, the system works, but if the top one is selected first, both of the instances stop pulsing. :(
B
5
Posts: 12
Reputation: 249

Post » Wed Nov 25, 2015 3:32 am

Oh hang on! My bad, I had one of my variables mixed around!
B
5
Posts: 12
Reputation: 249

Post » Wed Nov 25, 2015 3:38 am

Dude, you've saved my life.

I've been tearing (what's left of) my hair out on this issue but you've managed to help with the problem in the time span of an hour.

Very hearty thanks. Thank you.

There are still a few hiccups but this has ironed out a lot of the kinks that I was getting really frustrated with.
Last edited by radioteque on Wed Nov 25, 2015 3:50 am, edited 1 time in total.
B
5
Posts: 12
Reputation: 249

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Magistross, mikva, newt, ThePakernator and 8 guests