Pin Sprite to Player Issue Between Layers

Get help using Construct 2

Post » Wed Apr 04, 2012 5:49 pm

Hi, all!

I'm working on a platform game and I'm having some issues bringing my player character from one layout to another or keeping my character sprite at the top layer while the Player sprite is below it. Going between the "Dying Screens" (aka Level1Dead and TrainingDead) and the previous layouts is sometimes ok but there are issues where the sprite Darius doesn't pin at the exact position as the Player sprite as it was when you initially play.

The bug some of my testers came up with is the fact that between Layouts Level0 and Level 1, the "Player" is active, but the Darius sprite is either not pinned properly (it's not positioned properly compared to the player sprite) or even worse, the Darius sprite is not visible at all.

Here's a CAPX file of the project I'm working on. I tried many eventsheet combinations but came up with the same result:

http://dl.dropbox.com/u/42828331/Journey%20of%20Darius/JoDv2.capx

What's a better way to go about transitioning between layers without having these issues?
B
5
Posts: 14
Reputation: 428

Post » Wed Apr 04, 2012 7:19 pm

I have looked at your CapX, and the problem was that, after completing the first level when you tell the game to start ignoring player's input and wait 8 seconds, you moved the Player sprite's position but you didn't move the Character's position. they are two different objects so moving the Player's position does not automatically move the character's position, it only does that if the Player sprite is moving pixel by pixel on screen.

I have re-uploaded your CapX with a comment above the changed Event:
http://www.sendspace.com/file/7x4wok

hope that helps. and nice game :)
B
16
S
3
G
4
Posts: 40
Reputation: 3,877

Post » Wed Apr 04, 2012 8:42 pm

@KiyowaraKush Things seem to be fixed, however, I have a feeling I may have to adjust my image points as the sprite still goes off a bit after Darius dies or if he transitions between layers. Is there an alternative if this doesn't work? I also think I may have to re-adjust sizing and image points for my character and player so they're the same. It's a start. Thanks!
B
5
Posts: 14
Reputation: 428

Post » Wed Apr 04, 2012 11:44 pm

Is there any particular reason you're using the pin behaviour? If you just want your sprite on top of your "Player" object at all times, put your imagepoints at the bottom middle of both sprites and use the "Set position to another object" condition instead.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Apr 05, 2012 9:11 am

you can try what Nimtrix said by using System - Every Tick: 'Set position to another object'
or you can use the 'set position' action with X as Player.X and Y as Player.Y and add a value to the Y/X value. for example, if you want the sprite to be a little bit higher, you can put: Player.Y -10 etc.

up to you, hope that helps
B
16
S
3
G
4
Posts: 40
Reputation: 3,877


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, LeFuji, newt, RookieDev, TRMG and 19 guests