[SOLVED]Castlevania-like world system

0 favourites
  • 8 posts
From the Asset Store
Push the Box Puzzle Game likes Sokoban made with Illustrator
  • 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.

  • 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.

  • just curious can you do the same with just one layout or does it take up too much ram ?

  • 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;)

  • 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.

  • 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:

    <img src="http://i5.photobucket.com/albums/y173/crawllikeinsects/start-of-layout_zps0b9451b6.png" border="0" />

    in removePlayer do something like this

    <img src="http://i5.photobucket.com/albums/y173/crawllikeinsects/end-of-layout_zpsf17f05ef.png" border="0" />

    and in system do something like this

    <img src="http://i5.photobucket.com/albums/y173/crawllikeinsects/triggerlogic_zps6e24caed.png" border="0" />

    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 :P

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the help ppl! I got it working:) Here is my solution:

    <img src="https://dl.dropbox.com/u/1396615/bugImage/LevelTransition.jpg" border="0" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)