Pin and set position issues

Get help using Construct 2

Post » Mon Oct 14, 2013 7:18 am

Hello All

------------------------------------------------------------------------
Basically I want to simulate separate body parts moving dynamically with each other, either with a pin or with a set position action. In this case, an arm that aims toward the mouse input (already scripted), and also have the shoulder bob up and down with a separate walking animation (my trouble).
------------------------------------------------------------------------


I have a character in game whose walk/run/death animation is completely separated from his arm. I have it set up this way to give the arm the flexibility to revolve 360 degrees around the shoulder pivot.

I have a problem, and I'm not sure if it is my fault of Construct's. At first the arm was pinned to the shoulder image point, and it followed the player flawlessly.

However, my player seemed very stiff when walking/animating, so I added a more dynamic walking animation, and set the image point of the shoulder to change every frame, moving up and down as the player walks.

I thought this would work, but the arm now lags way too far behind the player.

To fix it by setting the position of the arm to move forward depending on the player's speed:
(Arm_Pos.X+2*(Player.Platform.Speed/28), Arm_Pos.Y)

...Which keeps the arm in place, but now it is extremely shaky.

So, I'm at a loss. I have also scoured the forums to no avail. If anyone has successfully done something similar, help would be thoroughly appreciated.
B
7
S
2
G
2
Posts: 14
Reputation: 1,626

Post » Mon Oct 14, 2013 7:30 am

Are you using pin or set position now?

system every tick: set arm: shoulder.imagepointX(1), shoulder.imagepointy(1)

This should work.

The lagging could come from the shoulder changing position in the eventsheet after the arm is set into position. The order of events could be your issue.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 14, 2013 7:30 am

@Trunk252 Have you looked at the plugin Spriter? Although I have never had need to play with it, it sounds like it was designed to do exactly what you are looking for.

A capx would also be useful to see what you is actually happening.

If I remember, behaviours (pinning) are frame rate independant, and you are most likely setting the image point per tick, making it frame dependant. Not sure if that could cause the lag, but I am starting to get out of my depth here.
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Mon Oct 14, 2013 7:40 am

Thanks for the quick responses. I would upload the .capx, but its fairly big (200mb+)

Here is a link to the game, if you want to see my player layout. Just go to Arcade Mode.
https://dl.dropboxusercontent.com/u/211250504/NoctisHorroremV0.64/index.html

@LittleStain In this version I have it on pin, but I hate how stiff the animations look. So, I'm trying to make this more dynamic. My work file now has it set to the position of the shoulder, thus lag. It could possibly be my event sheet...

@ AngelEyes I actually do use spriter, and its great. However, I need to move the arm independently from the player animation. Which, may...? be possible with spriter?
B
7
S
2
G
2
Posts: 14
Reputation: 1,626

Post » Mon Oct 14, 2013 7:51 am

I think the problem is you are trying to pin your arm every tick, but that's not what the pin behaviour is meant for.

once you pin a sprite it will move relatively to the sprite it's pinned to. Resetting the position of the pin every tick makes the pin behaviour kinda useless.   
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 14, 2013 7:57 am

I'm not pinning every tick; I never did that. Sorry If I was unclear.

I am setting an X and Y position every tick, but that's when the arm starts to lag behind the body.

Edit: Also I'm not using pin with set position. I only have it set to set position now.Trunks2522013-10-14 07:59:37
B
7
S
2
G
2
Posts: 14
Reputation: 1,626

Post » Mon Oct 14, 2013 8:03 am

The arm is pinned and you are trying to set it's position at the same time?

That means every tick the arm is told to be at two different positions
1 - the position the pin behaviour demands.
2 - the position you tell it to be.

That wont really work.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 14, 2013 8:13 am

Yeah, I figured that out after trying it. Lol.

Pin + set arm angle worked fine, but it was too stiff for my taste. So I trashed pin for now.

Now I'm doing set position + set arm angle, and it would do exactly what I want except that it lags.
B
7
S
2
G
2
Posts: 14
Reputation: 1,626

Post » Mon Oct 14, 2013 8:56 am

Check if the order of your events is right.

The position of the arm depends on the position of the shoulder, so the shoulder must be set in the correct position first in your event sheet, the angle of the arm depends on it's position so position of the arm must be set before the angle.

so the order should be:

- make sure the shoulder is in it's final position for that tick
- make sure the arm is in it's final position for that tick
- set arm angle.

If this is all correct and lagging still occurs, seeing how your events are set up might give an answer.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 14, 2013 9:07 pm

So I made a sample file with a player and an arm that is set to the player every tick and also follows the mouse.

https://dl.dropboxusercontent.com/u/211250504/setPos_setAngleEXAMPLE.capx

There is literally only one event and it works great; no lag. It would appear that my massive event sheet is the culprit. I'll have to re-arrange some stuff.
B
7
S
2
G
2
Posts: 14
Reputation: 1,626

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests