Bizarre issue I'm having

Just started using Construct 2? Post your questions here

Post » Fri Dec 16, 2016 9:47 pm

Message: Zedaskovy can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello friends, yes this is my very first post here. Hi!

I'm making this very simple game as an assignment in my class, but I'm having an issue I simply can't find the reason why its happening, so let me explain:

In the 3rd stage of the game, I organized the events and actions so they would spawn two obstacles (rocks) side by side, each one in a different lane (there are 3 lanes) of the stage. The obstacles are spawning as intended, but here the problem: I've set the animals the player controls to stop when they overlap an obstacle, however, for some reason I can't discover alone they aren't stopping when they overlap the black stone. Just the brown-ish one.
I'm sending a link to the CAPX. The issue I talk about is happening within the stage 3 sheet.

http://www.filedropper.com/gamefull16dezembro2
B
4
Posts: 4
Reputation: 208

Post » Fri Dec 16, 2016 11:11 pm

In stead of

stone is overlapping beast
or
stone is overlapping beast

try

beast is overlapping stone
or
beast is overlapping stone


Better would be to bring the obstacles in 1 object, as animations.
You can do the same for the animals. Animations gonna be named Animal_Action....
Now you have only 2 objects (and there instances) to handle ... will be 1/10th of the amount of code you have now.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Dec 16, 2016 11:16 pm

<ninja'd but...>
It looks like you've found a bug in C2. You need to simplify this into an example CAPX to upload, but the issue seems to be, having two obstacle overlap tests, where you are testing two different objects to the same object, the second one is not detected.
If you switch the order in your example, (check obstacle2 first), it works for #2, but then fails for #1.

To get around this for now, I found that if you switch the order around, check for 'animal' overlapping #1 or 'animal' overlapping #2, it does work.

I think the technical issue is that, the current implementation picks the 'animal' that is overlapping the first checked obstacle, but holds on to that picking list, which would be empty, since no animal overlaps in the first case, then the OR is run to check the second obstacle, but there are no animals picked now, so the whole thing fails!
ImageImageImage
B
71
S
22
G
240
Posts: 3,733
Reputation: 133,992

Post » Sat Dec 17, 2016 1:26 am

Ok, thanks. Will try what you guys have suggested

and lol finding a bug, now there's something I did not expect to do.
B
4
Posts: 4
Reputation: 208

Post » Sat Dec 17, 2016 1:28 am

Also yeah I forgot to simplify it into an example :\ was desperate because I'm running out of time... my bad!
B
4
Posts: 4
Reputation: 208

Post » Sat Dec 17, 2016 1:32 am

99Instances2Go wrote:In stead of

stone is overlapping beast
or
stone is overlapping beast

try

beast is overlapping stone
or
beast is overlapping stone


Better would be to bring the obstacles in 1 object, as animations.
You can do the same for the animals. Animations gonna be named Animal_Action....
Now you have only 2 objects (and there instances) to handle ... will be 1/10th of the amount of code you have now.


Oh yeah, also thanks for the animations tip! I've been working on this thing for some time now during classes and at the start I didn't know a thing about C2, didn't know how to make the animations, so I made the 3 animals as separate sprites. I'm so used to it being this way that I didn't even think of changing them to 1 sprite with different animations... but I'll certainly do it.
B
4
Posts: 4
Reputation: 208

Post » Sat Dec 17, 2016 9:54 am

Well, i gambled that you cant use families (paid version). If you learned a lot (trying to rephrase cautious), it might be time to code it again from scratch. You will notice that it will be not that much work. At this moment you add to a base that has a 'early understanding', and you will feel like you are 'patching things' for ever.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests