Pinning Objects to move-able objects

Just started using Construct 2? Post your questions here

Post » Fri Jan 30, 2015 7:08 pm

Sorry for making another thread so soon!
I've ran into another problem while creating my level: essentially I have a pushable block which I want the player to be able to climb onto. I've done this by following a few other guides, (one of which was pushing/pulling blocks, the other climbing edges), which separately work fine, but putting them together gives me some trouble.

I have a sprite overlaying a block which acts as a platform object (though only when the player 'overlapper' sprite overlaps it), the block follows the sprite at every tick. So the player can move it left/right, works fine.
I also have a LedgeSprite, which if the player hits 'e' when next to, will climb on top of the sprite. I have pinned these sprites to the sprite overlaying the block (one in the top left and right corners), but I notice no matter what I do the LedgeSprites won't move with the block as it should, it lags behind a fair bit (with the one on the right not moving at all). Example: giphy DOT COM /gifs/3xz2BLfSy49auTrXOw

I've included another screenshot of my event sheet here. Again, very new, so please forgive me if it's confusing to look at/doesn't make much sense. And sorry for the very specific problems I'm having.
Image
If there's anything I've left out, please let me know! Thanks!
B
4
Posts: 6
Reputation: 212

Post » Fri Jan 30, 2015 8:01 pm

You probably shouldn't pin the LedgeSprite to the Sprite9 every tick. And do you have more than one Sprite9? If you have another Sprite9 the second LedgeSprite is probably being pinned to it because you're not specifying which Sprite9 to pin to. That would explain why it's not moving.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Fri Jan 30, 2015 8:16 pm

Hey there! I should've named Sprite9 to 'shelf' huh? Sorry if it's confusing. But no, there's only one Sprite9 In the scene right now!
EDIT: Oh, forgot to mention, the ledge sprite isn't set to every tick, that's the Movesprite (the thing that the shelf sprite follows).
B
4
Posts: 6
Reputation: 212

Post » Sat Jan 31, 2015 12:18 am

In events 57/58 the LedgeSprite is being pinned to Sprite9 every tick as long as LedgeSprite is overlapping MoveSprite. You only want to pin it once. If the ledge sprites are always fixed to the ends of the shelf you can pin them 'on start of layout'.

What's happening here is that the shelf moves to the right and the ledge sprite gets pinned a little further back every tick until it's no longer overlapping the MoveSprite.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Sat Jan 31, 2015 3:42 am

And with that... it works! Thanks a million Ramones!
B
4
Posts: 6
Reputation: 212


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest