Suggestion: Optional Pin lag

Discussion and feedback on Construct 2

Post » Sat Nov 26, 2011 10:37 pm

There was a fix to the pin function with r69 which fixed the unintentional lag with the pin function. I'm making a game now that has sprites trail the main hero sprite and have coded it up so it works, but was thinking it was be great if you could specify the lag on the pin command to a custom number of frames to achieve this without the considerable amount of commands I've had to use.

The way I see it you could set pin to 0 for locking items to the exact co-ordinates of the master sprite on each frame, however, if you set pin to 10 then there would be a 10 frame delay before the pinned items started following the master sprite, meaning they would position themselves to the relative location of the master sprite from 10 frames previously.

Not sure if it's viable but it would be a cool option :)jumprock2011-11-27 00:17:36
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Sat Nov 26, 2011 11:14 pm

I second that, to be able to have a slight lag as the main character moves is something I would need as well.
B
72
S
25
G
9
Posts: 382
Reputation: 10,649

Post » Sun Nov 27, 2011 1:02 am

This is the kind of thing it's better to do via events than built in to a behavior, IMO. You can easily replicate the pin behavior with the distance() and angle() expressions, then add your own lag or customisations there.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Nov 27, 2011 3:24 am

I guess I'm thinking specifically for things like having a pet/familiar follow you. You don't want to have to worry about making any complex AI or building too much logic to control it, so you just get the follower to retrace the player's exact steps via recording your their positions each loop. It looked like Pin was pretty much doing this previously, although unintentionally, when there was a lag.

It was more a suggestion of if that functionality is a by-product of the way pin works anyway, why not add it as an option.
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Sun Nov 27, 2011 3:50 am

It really isn't that hard to recreate via events - it doesn't add as much complexity at it seems like it would. Besides, if this functionality were to be implemented, I think a new behavior with a more appropriate name should be used - a 'follow' behavior, for example. Pin should do what it says. It wouldn't be easily apparent that pin could also follow.Arima2011-11-27 03:51:03
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Nov 27, 2011 7:02 am

Hey Arima, I've got a solution now but it seems kind of long winded, any chance you could explain more about of how you'd do it with events?
B
16
S
5
G
1
Posts: 43
Reputation: 1,595


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests