Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am kinda new to flash/AS3. I have written some stuff and now I now the basics of AS. I want to develop a game in which my character moves. exactly like the way Super Mario moves(the background changes and new obstacles come in the way like and animation with which you can interact by climbing and shooting etc.) There is one big thing that I don't understand is that how to make my background moving and introduce new obstacles when my character moves forward. Currently my scene is static which means the background is the same and obstacles are also stationary. Can some point me to a tutorial or give me an answer that solves my confusion? thanks

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You want your game-world to consist of several "chunks", so that you can add/remove elements to your scene when necessary. Some games use chunks the size of one screen, so you'll always see 4 of these chunks at the max.

The most flexible way for this kind of game though, is to use a tilemap. You can create those maps by using an existing editor, like Tiled or Ogmo Editor.

For the scrolling, you'll need some sort of "2D camera" that moves around with your character and defines the visible portion of your screen. You can also apply some drag to the camera, so that it follows the character with a delay.

To add the illusion of depth, you can create one or multiple background layers that move with a fraction of the camera speed (parallax scrolling).

All this stuff is already present in game engines like flixel or flashpunk so it might be worthwhile to check these out if you want to start create the game right away. If you want to implement that stuff all by yourself for learning purposes, that's fine too.

share|improve this answer
    
If you choose Flixel as the game engine then you can use Dame as the Tile/Map/Level Editor. They work together very well. –  Snow Blind Aug 5 '12 at 8:06
add comment

You are looking for a basic side scrolling tile engine.. In the case of later Mario games it has multiple layers for the parallax scrolling background (which just makes what is really far away scrolls slower than what is close by). A quick google search should give you quite a few ways to accomplish this task.

In later Mario games, as far as screen scrolling goes, using two bounding boxes is also a good idea. One central box that mario can move around in that does not require the screen to scroll. As soon as mario gets outside that box the game should move slowly to keep him in it.. A secondary box thats a bit larger would be used as a 'mario cant get out of this box' sort of deal. This would be when the game Has to scroll at the speed mario is moving at.

Hope this helps, those were the major things I had to accomplish when I made a mario clone for school all those years ago.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.