Been a while since I did any semi decent AS coding. And it still is.
Lookit what I've made...Arrow keys to move in an 8-Way direction for now
Okay. My brain's not currently working, so I'd like people's input about now for an engine I'm making. As you should be seeing, it's a top down engine in the style of the original GTA games.
Rather than copy and paste the code (which would be pointless), I'll go through the steps I've done to make this.
Upon loading, it kicks off the Graphic Engine Start Function (was feeling bad with names)
- It spawns the red row (drag item out of library through linkage, give it a name and a depth) of dots along the screen according to locations stored in an array
- It then spawns the pink row of dots at the same place, but thier proportionate x and y to the blue dot (player) are scaled by how many stories it should be up (also stored in an array - it's faux Z value)
Then it kicks off the Refresh Graphic Engine Function as an Interval every 100ms.
- It then draws a line between the red and pink dot in a blank "Building" movieclip. So I know that it's working. And indeed it does.
- The roof information is stored in an array of integers. The numbers in the array correspond to the names of the spawned dots (so 0 is pinkdot0, 1 is pinkdot1, etc). Starting at the first item of the roof array, it draws a line from it's last item to the current item. If the current item happens to be -1 it closes the fill, and then jumps to the next point and opens a new fill. So far, so good
- Then it starts to draw in the walls. And this is where I'm having issues. It does this in a similar fashion - it draws them in by reading from two arrays of numbers (lets call them A and B) and draws a quad from pinkA to pinkB to redB to redA back to pinkA. This is all drawn in a blank "wall" movieclip.
- When the function next is called by the interval, the wall, building and roof movieclip contents are erased, so that they can be redrawn
Problems I've got
- Thanks to the way it just reads through the arrays for building walls, there is no actual Z-Buffer. All the walls are drawn in order, and that becomes a problem when you want to go up. I've had the colours of the walls drawn so that there's a sunrise lighting just to show what I mean - the walls seem to be going through each other in escherean fashion
- Solid colour bites. Eventually (after solving the above problem so that the walls with thier backs to the screen *don't* render) I'd like to fill them with bitmap fills that are distorted to the right size. Is this one a pipe dream? I think I've seen 3d engines do it before, and would like to know how I can do this myself
- Currently it scrolls by the actual world moving under the player and not the other way around. I'm not sure how the VCAM would mess up my engine as it currently stands, but I would like to know other people's thoughts of scrolling. I'm pretty sure making the entire world move just for the blob in the center is overkill...
- There's just too much data already. Those seven buildings comprise of 3 arrays of 27 points (X, Y, and Height), and three exceptionally long arrays (one for the roof, two for the walls) - making an entire city this way is going to kill me. Can anyone think of a way I'm going to be able to trim this down?
Your thoughts are always valued