How do I move to another layout in same position x,y

Get help using Construct 2

Post » Mon Oct 27, 2014 3:41 am

after a lot of failures making games, i have decided to lower down my exceptions so dumb,
its impossible for me to fail.

cough...apparently a few months of debugs, google search haven't even yet solve a simple yet
important function in my new maze game, lol.

what i want is the ability to let the player to go to a ladder,
which teleports the player to layout 2 in the same position x, y.

and then the player can take the ladder down to layout1.

this is basically a very simple game that mimicks my childhood pencil and paper game,
where the player is stuck in a maze with lots of layouts and he can move
between layouts using ladders.

any help is much appreciated.
You do not have the required permissions to view the files attached to this post.
B
28
S
13
G
15
Posts: 87
Reputation: 10,469

Post » Mon Oct 27, 2014 5:12 am

Put an invisible sprite with its origin point-0 where you want the origin point-0 for your character on each layout level and simply have it spawn the character at its 0 origin when layout level loaded. You will need a different one for each level so just name them ladder1-2, ladder2-3, etc. If he can return up the ladder then put ladder2-1, etc on other end...

Why are you using layouts and not layers you set to visible/invisible?
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Oct 27, 2014 7:26 am

Here done try it
You do not have the required permissions to view the files attached to this post.
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,596

Post » Mon Oct 27, 2014 11:53 am

thanks a lot @Lordshiva1948 and @chrisinfinger for helping a nub like me. :D

Lordshiva1948, you have made it that the player can move in between layouts but i need it that the player is at the position that i determined which is the about the same x, y position.

or to make it easier to understand: i will have 5 staircases in each layout, so the player needs to climb the staircase
upwards directly to another layout in same x, y position and not like going to any x, y position in another layout.

chrisinfinger, i didn't know you can do it by layers, layers sounds like something i can do but i want try to solve it by layout due to the intense curiosity i have garnered by trying to fix it by layout for such a long time.

the capx this time i added in persistent to the player and a second staircase.
can you guys or someone else shows me how you make it that the player can actually move to another layout in the same position x,y or near staircase for both staircases.
You do not have the required permissions to view the files attached to this post.
B
28
S
13
G
15
Posts: 87
Reputation: 10,469

Post » Mon Oct 27, 2014 12:54 pm

Is this how you wanted it?
You do not have the required permissions to view the files attached to this post.
B
74
S
28
G
17
Posts: 256
Reputation: 15,125

Post » Mon Oct 27, 2014 1:05 pm

A quick and dirty way that should work, would be to have two global variables
let's call them:
PlayerPosX and PlayerPosY

every tick set PlayerPosX to Player.x and set PlayerPosY to player.y

On start of layout - Player set position x:PlayerPosX y:PlayerposY

This is ofcourse not a neat and tidy way to do it and all other suggestions are actually better than this one, but just thought I'd mention it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 27, 2014 2:24 pm

Or you could use Instance variables to go to spacial ladder of your choice
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,596

Post » Mon Oct 27, 2014 5:53 pm

There are multiple ways to do it but the essence of them boils down to... something has to tell the next layout where you want it to place/spawn the player instance when it arrives.

Another possible way would be have a new global layout type shared with all layouts that only stores the entry and exit locations... but I haven't fooled with global layouts so don't know if this would work. :)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Tue Oct 28, 2014 4:15 am

thank you very much to @Xavier, @LittleStain, @Lordshiva1948, @chrisinfinger!
now i dun need to go back to pencil and paper game making, LOL XD

im now using xavier's method which is similar to what i have been trying to attempt all along,
the problem why my method doesn't works is because i keeps on trying to set position the player to an object
on the next layout which maybe haven't yet loaded completely which then causes a lot of bugs to confuse me.

xavier's method sets the position of the player to the object/co-ordinates to the current layout
and not the next layout.

LittleStain's method works and uses very little events as my game will have lots of layouts
but have some flashes( player teleporting in between layouts continuously.)
B
28
S
13
G
15
Posts: 87
Reputation: 10,469


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 4 guests