How can I stop the "8 Direction" behaviour doing this?

Just started using Construct 2? Post your questions here

Post » Mon Jan 04, 2016 1:48 am

Sorry for the shoddy title, not enough space to explain what I mean!

I've been using Construct 2 for about a week and at seemingly complete random the 8 Direction behaviour in all of my projects is changing Vector X / Y 'incorrectly'. What's happening is when I'm moving just left, the Y Vector will set itself to a number above 0. When I'm moving just up or down, the X Vector will also then set itself to a number above 0. I have no idea why it's suddenly decided to do this.

The problem with this is that any events I have using the 8 Direction condition "is moving" now don't work properly. Because the player can be right up against the a wall, press the arrow key into it, and since the Vector Y / X will set itself above 0 for some reason, the player will now play the walking animation into the wall, because they are apparently "moving". (The other Vector works as normal.) Something interesting is that when it's set to whatever number, the character will not actually move in the direction at all. Another interesting thing is that pressing left will keep the Vector Y to 0, but pressing right will set it above 0 for whatever reason.

I looked this up here on Scirra and found only one other person who had this issue (they had submitted a bug report), and Ashley had replied stating it would be something to do with math calculations in the events. I looked through my own events and couldn't find any issues, so decided to make a completely fresh project with no events at all with one single 8 Direction sprite. And to my surprise, this issue happened there as well!

So now I'm guessing I've changed some setting somewhere by accident..? I'm really not sure where to go from here. I can't really go any further with some projects because I can't test anything to do with animations properly whilst this bug still exists.



If you've read all of the above and don't understand what I mean at all, that's okay, I made a 1 minute video to show what I mean visually. Hopefully by watching this the issue should become a lot more obvious to see.

The link got removed for my reputation, so I'll break it up here. "Piece together at your own risk" or something, I guess? "youtube .com / watch? v=LbIhlwR5spQ"



Hopefully this is something obvious I'm missing, I'd really like to get this back to normal, I have no idea what's caused it. Thanks in advance!
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 8:49 am

A video is not really of much use.

It would significantly speed up the process if you provided a small example of a project that has the problem you describe, and exact steps to reproduce.

That way, we can determine whether you have altered something or not, or even whether you have uncovered an actual bug.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
130
S
29
G
80
Posts: 5,275
Reputation: 55,982

Post » Mon Jan 04, 2016 8:35 pm

zenox98 wrote:It would significantly speed up the process if you provided a small example of a project that has the problem you describe, and exact steps to reproduce.


Here's a .capx file link:

This got removed as well.. here's a broken up version:
https:// drive. google. com/ open?id=0Bz6k_T7ICBNmNGpaZnpaR29YSzg

All that's in this is a sprite with an 8 direction behaviour. That's really all that's in here. You can see this issue happening if you run in debug mode, select the sprite, and check the Vector X and Vector Y values while moving in a straight line.
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 8:56 pm

I downloaded your file and checked my project, and it's completely true. The perpendicular vector value does change once you reach your maximum speed in any direction, though it doesn't actually move the player in that direction. This really looks like a bug.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Mon Jan 04, 2016 9:15 pm

C-7 wrote:I downloaded your file and checked my project, and it's completely true. The perpendicular vector value does change once you reach your maximum speed in any direction, though it doesn't actually move the player in that direction. This really looks like a bug.


It's really strange. If I do this on my project that was working just fine a few days ago, even though the values go up, the player never actually moves in that direction at all. I tested this by walking left into the wall for a while with the Vector Y showing that I should apparently be moving up, as well as making a very long canvas, but I didn't go a single pixel up. It's annoying because like I said in my post, it's completely screwing over my animations on that project, and I can't really get around it.

Strangely, I never updated my Contruct 2 but this still suddenly happened out of the blue. If you make a new project yourself just like I have done here, can you check if it happens for you as well? The only thing I can think of is that there's some setting I've changed unknowingly that carries over to the .capx which is causing it to happen on every project I export / view. The video I have on my original post is exactly how I made the .capx, it's only a few steps long.

"[r178] 8-Direction bug" is the name of the original thread with this issue, that Ashley replied to. I would link it to you but, you know.
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 9:22 pm

Ashley's answer is still valid. Computers produce small rounding errors all of the time. You have to deal with them. If you are basing your animation on VectorY=0, don't. Check for < 0.1, or something like that.
ImageImageImage
B
71
S
21
G
212
Posts: 3,616
Reputation: 119,651

Post » Mon Jan 04, 2016 9:29 pm

blackhornet wrote:Ashley's answer is still valid. Computers produce small rounding errors all of the time. You have to deal with them. If you are basing your animation on VectorY=0, don't. Check for < 0.1, or something like that.


I'm basing it on the "is moving" 8 Direction condition. I can't change it to be like that because there's points in the game where your movement is heavily slowed - and what if those numbers went higher for no reason as well?

I find it hard for this to be a rounding error because there's no calculation to even be rounded. Moving right keeps it on flat 0. All the other directions range from around 1 - 6 in the example I provided, but it's different for higher speeds. This has happened completely randomly and it doesn't make sense for it to happen.

When you press just left, you're only moving left. You're not moving a little upwards or downwards at all - it's just left. If pressing right can get this done no problem, and it used to work just fine for all sides, why does this have to happen randomly now? With the main project I have involving this I really can't make a workaround for this without having it not happen. There isn't even a single event within the example project.

Even if I did manage to get around this myself, it's still a big issue, because the "is moving" condition is practically worthless when this is happening. I don't know much about the program myself compared to pretty much anyone else around here, but I have a feeling Ashley was meaning calculations just within the events of a project.
Last edited by Frisk on Mon Jan 04, 2016 9:39 pm, edited 1 time in total.
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 9:30 pm

blackhornet wrote:Ashley's answer is still valid. Computers produce small rounding errors all of the time. You have to deal with them. If you are basing your animation on VectorY=0, don't. Check for < 0.1, or something like that.


It isn't an issue for my project, but the vector values can be significantly off.
Image
I'm not using vectors to determine things in my game, but even <0.1 would miss it--it's over 3.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Mon Jan 04, 2016 9:48 pm

:) You have to read the value correctly: it is 3 times 10 to the power of -14, which is: 0.00000000000003. Clearly this is 'almost' zero.
ImageImageImage
B
71
S
21
G
212
Posts: 3,616
Reputation: 119,651

Post » Mon Jan 04, 2016 10:18 pm

blackhornet wrote::) You have to read the value correctly: it is 3 times 10 to the power of -14, which is: 0.00000000000003. Clearly this is 'almost' zero.


What's causing it to be above flat 0 though, when going right works perfectly fine in comparison and this never used to happen before?
B
7
S
1
G
1
Posts: 11
Reputation: 527

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: joliemoc and 1 guest