A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Multiple levels in a side scroller

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    23

    Multiple levels in a side scroller

    I apologize for this simple of a question, but recently I decided to get back into Flash game design after a long hiatus. I have a VERY minimal understanding of flash AS (my current copy of flash is Flash MX 2004 if that gives you an idea of how long its been)

    The reason I've gotten back into is because some friends and I were looking to do a remake of sorts to the old Castlevania II: Simon's Quest game. Now I know this is hardly the type of game a newbie programmer should embark on, but we have no timelines, so it's hardly a rush job. I have the understanding of basic side scrolling tutorials (movements, collision detection, etc.) but my biggest issue is level design. I've seen examples where the level is loaded via a map editor (XML file) and that seems fine (though I would need to do much more research on it), but most examples I've seen are "objective" based. IE: there is a goal (think flag in Super Mario) As anyone whose played Simon's quest, that's not the case. These are multiple "levels" with different backgrounds, enemies, etc.....all contained in one game seamlessly. I haven't seen a good way to compile this style of game.

    One thought I had was to have the main MC (hero) and build each "level" on each frame. Then hitTest the hero against the sides of screens to advance to each frame. It sounds cumbersome to say the least.

    Basically, my question is: does anyone know a simple, yet effective way, to have multiple levels (ones that can be revisted while in game) across the whole game.

    Thanks in advance for any ideas. Again...sorry for the VERY newbish question.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Are you asking how to build your game first place or how to create seamless scrolling over large number of maps?

    All these old games used tile-based system (I have written several tutorials about it). Mostly because using tiles is faster and requires less memory. And you can build game same way with Flash too. You probably want to use map editor which spits out map data in some format (can be xml file) and then in the game you build the map back from tile sprites using the map data.

    You can also build the game using movie clips and vector graphics straight in Flash IDE (called art-based platformer). This way you can simply draw and place map items in the Flash without the need for extra map data - whatever is visible on screen is the actual map.

    Now in both cases using very large maps, like whole game at once, becomes pretty complicated. There is just too much data to process or draw. So its probably better to split map into smaller pieces and stick them together dynamically.

    Here is simple way to scroll horisontally using several smaller maps:
    *lets say you are moving from left to right
    *your screen is 300 px wide
    *current map is 500 px wide
    *hero starts at left edge (x=0) and moves 200 px to the right
    *to get background scrolling, you move map 200 px left instead of moving hero 200 px right
    *but since current map is only 500 px wide, it will end and leave empty space to the right
    *so you use 2 map background, map2 is placed 500 px to the right of map1
    *while you continue to move right, map2 becomes visible and eventually map1 is moved completely out from left
    *then you can take map1 and move it to the right side of map2. Player wont notice it because map1 is out of screen

    This way you can create seamlessly scrolling maps from smaller parts. It will work same way with both tile base system and art-based game.

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    23
    Quote Originally Posted by tonypa View Post
    Are you asking how to build your game first place or how to create seamless scrolling over large number of maps?
    I'm sorry, I guess I'm looking for both.
    Seriously though, I'm kinda asking about the seamless scrolling. I found a better term to describe what I'm looking for....rooms.

    Essentially, I'm looking to make a side scroller with rooms, instead of levels (with goals)

    Say you're walking to the right (as you had in your example) once you reach a predetermined spot on the far right of this level/room, you would go to the next level. But you could go back to this first level. Think a town level....that turns to a forest level, but you could return to the town level.

    I'm just curious what would be an efficient way to do this?

    I have about a million other questions, but this one could get me started with simple level design. Also would this room idea work better with that art based programming you spoke of? Or having the tiled method?

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    So basically you want to have doors (visible or not). Once the hero steps on door, background changes and hero appears in new location next to the door returning back to previous screen.

    It can be done with both systems. In art-based game you can use hittest to find if hero is over the door graphics. You need to set few parameters in each room, like which frame to show and new coordinates for hero.

    Lets say you have door movie clip with instance name "door1". Set up doors object:
    var doors = new Object();
    doors.door1 = new Object();
    doors.door1.nextRoom = "forest";
    doors.door1.nextHeroX = 100;
    doors.door1.nextHeroY = 50;

    Once your collision function has found that hero has moved over door1, you can read the values from door object, use gotoAndStop to show frame labeled "forest" and reposition hero to new coordinates.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center