Set Origin problem on Ashley's tutorial - question

Get help using Construct 2

Post » Mon Jun 17, 2013 11:05 am

Hi,

I've been following Ashley's tutorial on making a platform game and have come up against something I can't figure out.

I set a rectangle as the 'platform' object and placed it over the player sprite. No problem so far. I also set the origin point at the bottom centre for both the sprite and the platform object as instructed.

In Construct, the rectangle has been placed over the sprite, so that as per the tutorial the rectangle covers the body in the image, and I set the opacity to 50% so I could see it. Yet, when I run the game at this point with the platform object set to visible, it appears offset - the blue rectangle only covers part of the sprite's body because it has moved slightly to the left.

How can I get the platform object to be placed on the sprite when running the game in the same place it appears within Construct please? I hope that makes sense?

Cheers Leaston2013-06-17 11:08:39
B
20
S
7
G
6
Posts: 19
Reputation: 4,947

Post » Mon Jun 17, 2013 11:18 am

Create an event: At start of layout, set the sprite to the position of the rectangle, and pin it to the rectangle.

If it's still offset then the origins must be off, or there's something else affecting the position of your sprite. Post your capx for us to see if you don't come right.
B
57
S
15
G
11
Posts: 912
Reputation: 12,596

Post » Mon Jun 17, 2013 11:25 am

Hi GeometriX,

There's an event set in the tutorial where every tick, the player sprite is "Set position to" the platform object.

As the sprite and platform object are different widths, I wonder if it is the origin position then. Never thought of that. I'll have a mess around and see if moving the origin helps.

Cheers for the suggestion.
B
20
S
7
G
6
Posts: 19
Reputation: 4,947

Post » Mon Jun 17, 2013 11:28 am

Yep, you were right. I manually moved the origin point on the platform object and it is now in the correct position when the game runs.

Thank you!
B
20
S
7
G
6
Posts: 19
Reputation: 4,947


Return to How do I....?

Who is online

Users browsing this forum: Ami Samad and 5 guests