8 Direction Movement On Stopped/On Moved?

Get help using Construct 2

Post » Fri Jan 18, 2013 11:31 am

I'm looking for a way to simulate both the "on stopped" and "on moved" triggers in the Platform Behavior, but use them in the 8-Way movement.

Right now I'm simulating the "on stopped" looking for the condition:

Player -> 8 Direction Speed < 100

I combine that with different "when a specific animation is playing" for each direction to pick the correct animation.

The problem is that the animation is slightly triggered when I start moving. It strangely works so far because the frames kind of work, but that's more of a happy accident. Any help is appreciated.

B
40
S
11
G
6
Posts: 228
Reputation: 6,951

Post » Fri Jan 18, 2013 3:43 pm

This is what it sounds like is happening, correct me if I'm wrong:

Any time the speed is below 100 *and* a moving animation is playing, the game begins to play the stop animation. So when you slow to a stop you're fine because you go below 100 speed and play the stopped animation once. But if you start moving again the game will try to play the moving animation again when the object is still under 100 speed! This causes the event to trigger again, playing the "stopped" animation from the beginning.

I can't really give you a precise solution because I don't know how you have your animations set up, but if my assessment is correct the solution is to make sure your moving animations don't fire unless the object's speed is greater/equal to 100.

Also, if you use a free file hosting service like drop box to host a single file capx of your project it makes helping you a lot easier. Screenshots are less ideal but can work too. Without either it will be hard for me to help you further if my idea doesn't work.Phyvo2013-01-18 15:44:45
B
6
S
1
Posts: 40
Reputation: 917

Post » Fri Jan 18, 2013 4:02 pm

Here is the link to the Capx file.

http://dl.dropbox.com/u/56104169/Stopping%20Animations%201-18-13.capx

To see what I'm talking about, hit F to fly and move left or right with the arrow keys.
B
40
S
11
G
6
Posts: 228
Reputation: 6,951

Post » Fri Jan 18, 2013 4:22 pm

I'm starting to think now that maybe instead of triggering it by the speed of the character, maybe I should be triggering it by the release of a button. I know that letting go of the right or left key will stop the movement. I could set it up then. I will test that theory later.
B
40
S
11
G
6
Posts: 228
Reputation: 6,951

Post » Fri Jan 18, 2013 4:51 pm

Yeah my assessment is correct. If you set the stopping condition to be less than 400 speed the first frame of "leftstop" plays the whole time. This is because holding the button causes "left" to play but then later in the event list the stopping event checks for "left", sees "left" and causes "leftstop" to play instead, doing this within every single tick, leaving you stuck on frame 1 of "leftstop" until you release the button or exceed the speed set in the stop event. The stop animation works if you let go of the button because the game stops trying to play the "left" animation.

Playing leftstop on key release is actually a great idea. It should solve your problem since it will make it impossible for the game to try to play both animations at the same time.
B
6
S
1
Posts: 40
Reputation: 917

Post » Fri Jan 18, 2013 5:03 pm

I've used this before and it works well.

On keyboard *NOT* pressed Left Arrow
AND
On keyboard *NOT* pressed Right Arrow
AND
On keyboard *NOT* pressed Up Arrow
AND
On keyboard *NOT* pressed Down Arrow

-> Play Idle animation
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Jan 18, 2013 6:01 pm

Just tried the "on button released" method and it worked great. Going to try and implement a starting version later.

B
40
S
11
G
6
Posts: 228
Reputation: 6,951


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, qaisarehman and 33 guests