Garathe
23 posts
|
I’m basically wondering how many, or most, of you would handle a platformer on the programming side of things. I’m tossing up different ideas, like whether or not I want to do a tile-based engine, hard code level objects that refer to a base Object class, etc.
I’m still not totally sure if I will be going the route of having the screen scroll, or if the levels will be static, with enemies coming in (like for a 2D platform Shooter). I’m fairly certain I’ll end up wanting to scroll the screen, so I suppose that should be kept in mind, as hard coding values for a long level would make the code quickly unmanageable.
So what should I do? Should I set up some tiles, do a text file or xml map and load in the levels, looping through them for collision detection? Or should I hard code? Or is there something else I’m missing entirely?
I’d love to have some responses on this. I’m fairly new to AS3, but I do know I want to get the design as Object-Oriented as possible (ie, not using a bunch of frames, old flash tricks from back in the day, etc).
Any feedback will be greatly appreciated. Thank you!
|
|
|
qwerber
4717 posts
|
Flash is a good engine to develop this one. You can also try C++ or C# but you won’t be able to upload those here.
From there, you set up rectangular collisions.
|
|
|
Garathe
23 posts
|
Well, I already know roughly how I want to do collision, and I can get a handle on that later. Right now I’m still wondering how I’m going to let the code know what objects are in the levels so that I can actually make things collide.
|
|
|
qwerber
4717 posts
|
Store the levels externally in .json files and load them at runtime.
|
|
|
BobJanova
860 posts
|
I have a set of entity classes in the code base, and load in an XML file for the level which refers to them.
|
|
|
Garathe
23 posts
|
Would it be silly to have all the art for the tiles in separate movieclips in the .swf? Like, CornerGrassTile, MiddleGrassTile, CornerStoneTile, etc? Or should I group them all in a certain kind of file and clip them out? And is there anything specific I need to do with them when I clip them out? Like assigning them to a certain array or something?
|
|
|
Drakim
1153 posts
|
Originally posted by Garathe:
Would it be silly to have all the art for the tiles in separate movieclips in the .swf?
Why would you want to store the art for the tiles in movieclips? By tiles, you mean a square image right? use a Bitmap instead.
|
|
|
Ace_Blue
1092 posts
|
Use a single Bitmap for all of your tiles. It’s called a sprite sheet. Whenever you want to draw what’s on the screen (every frame, presumably) you just loop over the tiles on screen and copy the appropriate pixels from the sprite sheet in the appropriate place on the screen. It’s fast and it’s easy, you’ll never want to see a MovieClip again.
|
|
|
RTL_Shadow
1023 posts
|
Originally posted by Ace_Blue:
Use a single Bitmap for all of your tiles. It’s called a sprite sheet. Whenever you want to draw what’s on the screen (every frame, presumably) you just loop over the tiles on screen and copy the appropriate pixels from the sprite sheet in the appropriate place on the screen. It’s fast and it’s easy, you’ll never want to see a MovieClip again.
Problem with that is sometimes it doesn’t look as nice a vector :(
|
|
|
Drakim
1153 posts
|
Originally posted by RTL_Shadow:
Problem with that is sometimes it doesn’t look as nice a vector :(
You are wrong.
If it’s a vector image, you have to use a MovieClip, as it won’t work in a Bitmap (bitmaps can’t hold vector graphics).
If it’s not a vector image, but instead a raster image, you can store it in either a MovieClip or a Bitmap, but they look the same! Putting a raster image1 in a MovieClip doesn’t magically make into a nice vector image.
1 regular 2d pixel image, like the ones you make in MsPaint
|
|
|
qwerber
4717 posts
|
If you aren’t zooming into the tile, then vector art looks just the same as a rasterized image.
|