So recently, I've gotten back into using Smilebasic, and I've been trying to create a top-down RPG sort of like the original Legend of Zelda. I originally based the BG collision off of an invisible Layer 3 so that I could separate the design of the level from the actual BG detection for various reasons.
Not-that-important reasoning:
Anyways, I wasn't really satisfied with this method because it required me to give up an entire BG layer, so I'm turning to data arrays. And ideas of an efficient way to implement this? I had an idea, but I'm not sure if it would be very resource-efficient, since I still have to take other factors like enemy AI into account.
My Idea:
Does anybody have any input on something wrong with this approach? I'd hate to do all of this only to find out that my method is too over complicated or anything like that, so any help would be appreciated!
Spoiler
Mostly because I had like 13 different hitbox tiles of different sizes (e.g. whole tile, top half of tile, lower right corner of the tile, etc.) just so I could fine-tune where the player could go instead of being confined to only 16*16 pixel tiles. Unnecessary? Probably, but it was really getting on my nerves.Spoiler
I would use a 2D array to record the data. Each value codes for one of three possibilities in a corresponding 8 pixel * 8 pixel space:- 0 -- Allows player/enemies to walk through freely.
- 1 -- Collision to all characters and objects. [used for walls]
- 2 -- Collision to all grounded characters and objects, but none for flying enemies and projectiles. [used for empty space, such as pits]