Getting screen transitions right

For questions about using Classic.

Post » Sun Aug 22, 2010 10:58 am

I'm trying to get a player character from 1 layout to the next. When I try to adjust the position of the player to the correct entry-point of the layout, he spontaneously teleports to somewhere out of the screen. It's all very frustrating, and I can't figure out what I'm doing wrong.
Please help

Cap can be found here: [url:258jafs2]http://www.mediafire.com/?9smh6a324ib39io[/url:258jafs2]
B
4
G
3
Posts: 39
Reputation: 978

Post » Sun Aug 22, 2010 1:20 pm

I got it working. For some reason construct messed up. I closed the file, deleted the persist file, and reloaded the project, and now it works.
Has anyone else had a similar problem?
B
4
G
3
Posts: 39
Reputation: 978

Post » Sun Aug 22, 2010 1:25 pm

Maybe I didn't understand you right, but I had no problems with you cap. If I set e.g.

+Blobby: Value "from_Layout" equal to "Layout 1"
->Blobby: Set X to 0
->Blobby: Set Y to 1930

Blobby appears exactly there.

EDIT: Ok, sry, you already did it :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sun Aug 22, 2010 1:41 pm

Thanks anyway, tulamide.

Of course, according to sod's law, the problem is back, and deleting the persist file won't help this time.
B
4
G
3
Posts: 39
Reputation: 978

Post » Mon Aug 23, 2010 9:08 pm

I have the strangest thing going on. In the cap posted in my first post, when I jump to the next screen, all is well, but when I walk off the screen, the player character tends to teleport to a random off-screen location.
Is it just me, or can anyone else reproduce this?
B
4
G
3
Posts: 39
Reputation: 978

Post » Mon Aug 23, 2010 10:30 pm

your two layouts are different heights.

Since the second layout is taller and Construct counts position from the top as zero, you might want to adjust height accordingly.

Change this in layout 1's events:
+ Blobby: On collision between Blobby and Gateway_forest
-> Blobby: Set 'from_layout' to "Layout 1"
-> System: Go to layout "Layout 2" with transition "None" lasting 0 MS
-> Blobby: Set Y to LayoutHeight - Blobby.Y <------- I ADDED THIS

Change this in layout 2's events:
+ System: Start of layout
-> Blobby: Set Y to layoutheight - Blobby.Y <---- I ADDED THIS
+ Blobby: Value 'from_layout' Equal to "Layout 1"
-> Blobby: Set X to 0
-> Blobby: Set Y to Blobby.Y +1520
-> Text: Set text to "X " & int(Blobby.X )
-> Text2: Set text to "Y " & int(Blobby.Y )
-> Blobby: Set XY to {0 ,Blobby.Y + 1000 }


Edit: this changes vertical coordinate to be relative from the bottom when leaving the layout, then uses that value to get the proper Y coordinate to start from in the next layout.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Aug 24, 2010 5:22 pm

Madster, you're a genius. It finally seems to work consistently. Thank you very much.
B
4
G
3
Posts: 39
Reputation: 978

Post » Wed Aug 25, 2010 7:52 am

Glad I could help =)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests