[SOLVED]Castlevania-like world system

Get help using Construct 2

Post » Sun Mar 10, 2013 12:30 pm

So If I want connect all layouts together to make a big world. For example: Player from layout 1 exit 1A can go to layout 2 and appear at entrance 2A, from layout 1 exit 1B can go to layout 3 and appear at entrance 3A. Typical RPG system.

I already know I can set "Go to layout("name")" on the exit object. then after spawn at next layout set player position to the according entrance object instance. But which instance to go? I was thinking to use "Pick nth instance" but it seems impossible.porky2013-03-11 10:40:44
B
14
S
2
G
1
Posts: 94
Reputation: 2,089

Post » Sun Mar 10, 2013 1:54 pm

Just use a global variable, and based on what that variable is set to, have the player character spawn there.

E.G.
>Player leaves layout 1
    >from exit Point A
        >set global variable to layout1A, AND go to layout 2
    >from exit Point B
        >set global variable to layout1B, AND go to layout 2
    >from exit Point C
        >set global variable to layout1C, AND go to layout 2


Then on the start of layout 2's event sheet.
>start of layout
   >global variable is set to "layout1A"
       >spawn player at "entrance A"
   >global variable is set to "layout1B"
       >spawn player at "entrance B"
   >global variable is set to "layout1C"
       >spawn player at "entrance C"

So on and so forth.
example I used a Text variable, you could also just use a number system but i like text as it is easier to understand.
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Sun Mar 10, 2013 6:10 pm

just curious can you do the same with just one layout or does it take up too much ram ?
B
7
S
2
G
3
Posts: 58
Reputation: 2,284

Post » Sun Mar 10, 2013 6:56 pm

@BACLog, I got your idea. The thing is I would like to use 1 invisible object called "Entrance" or something instead of "Entrance A,B,C" three objects. Because maybe I will have many entrances in one layout. My trouble is if there is 2 or more "Entrance" object instances in one layout, I don't know how to pick the right one to set player position to.

@Dragoonblade, yes it is because of memory and cpu power issue, that's why we have layout;)
B
14
S
2
G
1
Posts: 94
Reputation: 2,089

Post » Sun Mar 10, 2013 9:36 pm

Could you store the A, B, C part in an instance variable? So that when the player collides with an exit that leads to entrance A, you set a global variable to A, and when you load the new layout you set the player's location to Entrance who's instance variable is == (the global you set)?

You'd want to set up an instance variable for each direction on each entrance/exit, unless they are one-directional.
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Sun Mar 10, 2013 11:21 pm

Create a sprite object and name it (I call mine Vol_EventTrigger)Give it instance variables for gotoX gotoY and LVL

create global variables for spawnX and spawnY

create three event sheets and call them system createPlayer and removePlayer

in createPlayer do something like this:



in removePlayer do something like this



and in system do something like this



Now you can change parameters on a per instance basis and place as many portals to different layouts as you want

just create an instance of the Vol_EventTrigger as a sort of trip wire in the doorway to every area you want to send you player and then in that instances instance variables specify the spawn location and the layout you are spawning in to and voila!

now all you have to do is make sure the 3 new event sheets you created are included in your layout event sheets and you should be good to go

also note the structure of the Vol_EventTrigger events and the fact that what is listed is type = 0

this is so that you can assign another instance variable to your event trigger and call it "Type" and then you can create different conditions for each type of event trigger and then you can use the same object not only to trigger level switches but any number of in game events such as dialog with npcs or other scripted events

I do hope I didn't miss anything I'm not very good at giving instruction :Pshadowscawl2013-03-10 23:33:44
B
12
S
2
Posts: 18
Reputation: 1,377

Post » Mon Mar 11, 2013 12:34 am

Here is a capx i made for someone else, http://dl.dropbox.com/u/45198/Doors.capx

it is basically the same thing but just in the same layout. so all you would do is when the door opened rather then moving the player to the other door, set global variable, and goto layout 2.

make sense? if not i can make an example for you.
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Mon Mar 11, 2013 10:40 am

Thanks for the help ppl! I got it working:) Here is my solution:
B
14
S
2
G
1
Posts: 94
Reputation: 2,089


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Artpunk, Magistross, Yahoo [Bot] and 28 guests