Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complicated layering...
#1
I have just finished making a pixel by pixel map drawing engine.

I runs great due to a few modifications in the way it draws.

running: 70 - 73 FPS

so I decided to make another layer on the map, and that worked
well. so now there's two layers of graphics, one for grass, floors, and static tiles, and one for all the items and what not.

70 - 72 FPS

then I decided to make a third layer for over head tiles like tree
tops and walls (tiles that draw over the character)

but a problem arose...
here's how my engine ran at first:

-
Draw layer 1
Draw layer 2
-
Draw the characters
-

so, I thought, "where do I put the layer three?"

then I found out that there is no other way but to include the
drawing of the character in the drawing of the map!

e.g.
-
layer 1
layer 2
characters
layer 3
-

all in the same function.

here's the problem, when the drawing pointer passes over, it tests to see if he's there, and draws the sprite.
but the testing for it

IF X > than you.x
IF X < than you.x + 16

slows the program down so much that it's unplayable.

20 - 25 FPS

is there a better way to test?
is there a better way to draw???

(sorry, I can't post my code yet)

jony_basic
Reply
#2
i reserve tile 0 for a "blank" tile. that way when you put layer 3, if its 0 you don't put anything, so you put layer 1, 2, then char, then layer 3...

(sorry I can't help you yet)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)