multiple instances of one object - problem

Get help using Construct 2

Post » Mon May 27, 2013 9:15 pm

Hey Everybody,
I've got a probleem in my game that i can't figure out how to solve.
So I'm hoping that some of you could help me.

when something in my game is overlapping one switch it gets frame 1
and if not it has frame 0.
That works for one instance but if I've got more its causing problems.
after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer.

here's the code example -i hope it helps.
https://www.dropbox.com/s/320mu0amfaeac62/code.PNG
please help me i just can't find out what the problem is.
cannikon2013-05-30 13:05:16
B
3
Posts: 10
Reputation: 370

Post » Wed May 29, 2013 1:42 pm

is there anyone that could help me ?
B
3
Posts: 10
Reputation: 370

Post » Thu May 30, 2013 1:07 pm

i edited my post to make it simpler to understand.
please help !!
B
3
Posts: 10
Reputation: 370

Post » Thu May 30, 2013 3:23 pm

@cannikon

I couldn't access the picture (dropbox issue it seems), but maybe, you should compare if the switch is overlapping instead the object instead of comparing if the object is overlapping the switch

Also, what did you mean by :
"after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer."?

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
43
S
18
G
18
Posts: 2,106
Reputation: 16,436

Post » Thu May 30, 2013 5:14 pm

at first thanks a lot for the answer.
Unfortunately changing the overlapping like you said didn't help.

With the "after all were pressed at the same time, the frame just jumps back to 0 again when all aren't pressed any longer." i tried to describe the following issue:

If i just press one switch (by overlapping it) everything works fine (it changes the frames from "pressed" to "unpressed" just as it should.
When other switches get pressed while one is already pressed they all change their frames to "pressed" (so far so good), but when one of them then isn't pressed any longer, while one or more others are still pressed, it doesn't change its frame back to "unpressed".
Just when all switches aren't pressed any longer, they all change their frame back to "unpressed" at once.

i hope it helps
B
3
Posts: 10
Reputation: 370

Post » Thu May 30, 2013 5:23 pm

Maybe if you use an instance variable, a boolean, which will describe if the button is pressed or not, and with the value, change the position of the switch
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
43
S
18
G
18
Posts: 2,106
Reputation: 16,436

Post » Thu May 30, 2013 6:43 pm

thanks again but sadly this also did not work :(

i have just fast created a new capx with just this problem to show and make it clear.

https://www.dropbox.com/s/elyevl9rhg1kt7j/test.capx

hopefully now a solution will be found
thanks forward
B
3
Posts: 10
Reputation: 370

Post » Thu May 30, 2013 7:18 pm

Well event 2 will only set the frame back to 0 if event 1 is false - that is there's nothing overlapping any switch. Change the condition in event 2 to:

Sprite3 NOT overlapping Sprite2
AND
Sprite3 NOT overlapping Sprite5

spriteOverlap.capx

B
55
S
28
G
18
Posts: 1,520
Reputation: 25,275

Post » Thu May 30, 2013 8:10 pm

Pretty obvious but i just didn't come to that idea.

Thanks a lot to both of you
B
3
Posts: 10
Reputation: 370


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest