Pin to Image point don't combine with a sin?

Discussion and feedback on Construct 2

Post » Wed Feb 11, 2015 5:09 am

I have a character that has an attached head pinned to a body that has a image point(1) at top of the body.
The body has a sin (height), the image point (0) of the body is at the bottom, the image point (1) is at the top of the body, when you apply a height sin to the body the image height go up and down, only not the image point(1) and that's the problem.

I can't find any solution to keep his head on place when it jumps or fall down, at fast systems it's acceptable, but at slow systems his head comes of way to far.

I have try:
- pin (won't work) but should be the only way to get it work if the image point was updated according the sin I gave it.
- Always put head at position body.ImagePointX(1),body.ImagePointY(1) works to slow, head comes still of.

Do I miss something or is this not possible?

Thanks in advance
B
44
S
9
G
5
Posts: 110
Reputation: 3,730

Post » Wed Feb 11, 2015 3:23 pm

Can you provide a capx.

but as a heads up.
A pinned object can't be moved until un pinned.
You can't apply sin to the IP. just the objects
B
88
S
18
G
9
Posts: 2,455
Reputation: 14,911

Post » Wed Feb 11, 2015 3:30 pm

Have a look in this thread. This might be the solution you're looking for, I hope.
B
63
S
16
G
63
Posts: 2,170
Reputation: 39,985

Post » Wed Feb 11, 2015 5:53 pm

@Steely

Yeah, the pin behavior will not reflect changes in the parent's height/width. Fortunately, it's fairly easy to roll your own generic pin system using Controller + ConnectedSprite by using families.

I'm not sure what you're seeing without a capx, but here's a simple example manually re-positioning the head without seeing the popping-off behavior. And as a last resort, you can always turn your bug into a feature by repurposing your game into rockem-sockem robots. ;)


Here's a demo:
https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/index.html

Here's the capx:
https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/ImagePoint%20Attachment%20%28not%20pinned%29.capx
B
31
S
7
G
8
Posts: 232
Reputation: 6,194

Post » Wed Feb 11, 2015 9:15 pm

Thanks every one,

Ok here a example capx

Because it won't work with pin behavior I made a simple example exact how it's made in my game, it works perfect here, because there is only 1 line of code.
The game is a side scroller/runner game.
Biggest problem is when its running at a phone or tablet, then his head comes a quarter inch of.
You do not have the required permissions to view the files attached to this post.
B
44
S
9
G
5
Posts: 110
Reputation: 3,730

Post » Wed Feb 11, 2015 9:38 pm

This capx you've uploaded has this problem and/or your sidescroller game? We still need more details. Are you talking about native browser (safari/chrome) on tablet/phone, or wrapped like CocoonJS or PhoneGap?

Just tested this capx on my iPad 4th Gen using web preview without any problems. Could be a speed issue.
B
31
S
7
G
8
Posts: 232
Reputation: 6,194


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest